Changeset 142565 in webkit
- Timestamp:
- Feb 11, 2013 6:06:13 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r142563 r142565 1 2013-02-11 Kentaro Hara <haraken@chromium.org> 2 3 [V8] ScheduledAction::m_context can be empty, so we shouldn't 4 retrieve an Isolate by using m_context->GetIsolate() 5 https://bugs.webkit.org/show_bug.cgi?id=109523 6 7 Reviewed by Adam Barth. 8 9 Chromium bug: https://code.google.com/p/chromium/issues/detail?id=175307#makechanges 10 11 Currently ScheduledAction is retrieving an Isolate by using m_context->GetIsolate(). 12 This can crash because ScheduledAction::m_context can be empty. Specifically, 13 ScheduledAction::m_context is set to ScriptController::currentWorldContext(), 14 which can return an empty handle when a frame does not exist. In addition, 15 'if(context.IsEmpty())' in ScheduledAction.cpp implies that it can be empty. 16 17 Alternately, we should pass an Isolate explicitly when a ScheduledAction is instantiated. 18 19 No tests. The Chromium crash report doesn't provide enough information 20 to reproduce the bug. 21 22 * bindings/v8/ScheduledAction.cpp: 23 (WebCore::ScheduledAction::ScheduledAction): 24 (WebCore): 25 (WebCore::ScheduledAction::~ScheduledAction): 26 * bindings/v8/ScheduledAction.h: 27 (ScheduledAction): 28 * bindings/v8/custom/V8DOMWindowCustom.cpp: 29 (WebCore::WindowSetTimeoutImpl): 30 * bindings/v8/custom/V8WorkerContextCustom.cpp: 31 (WebCore::SetTimeoutOrInterval): 32 1 33 2013-02-11 Adenilson Cavalcanti <cavalcantii@gmail.com> 2 34 -
trunk/Source/WebCore/bindings/v8/ScheduledAction.cpp
r142250 r142565 50 50 namespace WebCore { 51 51 52 ScheduledAction::ScheduledAction(v8::Handle<v8::Context> context, v8::Handle<v8::Function> function, int argc, v8::Handle<v8::Value> argv[] )52 ScheduledAction::ScheduledAction(v8::Handle<v8::Context> context, v8::Handle<v8::Function> function, int argc, v8::Handle<v8::Value> argv[], v8::Isolate* isolate) 53 53 : m_context(context) 54 54 , m_function(function) 55 55 , m_code(String(), KURL(), TextPosition::belowRangePosition()) 56 , m_isolate(isolate) 56 57 { 57 v8::Isolate* isolate = m_context->GetIsolate();58 58 m_args.reserveCapacity(argc); 59 59 for (int i = 0; i < argc; ++i) 60 m_args.append(v8::Persistent<v8::Value>::New(isolate, argv[i])); 60 m_args.append(v8::Persistent<v8::Value>::New(m_isolate, argv[i])); 61 } 62 63 ScheduledAction::ScheduledAction(v8::Handle<v8::Context> context, const String& code, const KURL& url, v8::Isolate* isolate) 64 : m_context(context) 65 , m_code(code, url) 66 , m_isolate(isolate) 67 { 61 68 } 62 69 … … 64 71 { 65 72 for (size_t i = 0; i < m_args.size(); ++i) { 66 m_args[i].Dispose(m_ context->GetIsolate());73 m_args[i].Dispose(m_isolate); 67 74 m_args[i].Clear(); 68 75 } -
trunk/Source/WebCore/bindings/v8/ScheduledAction.h
r126484 r142565 46 46 class ScheduledAction { 47 47 public: 48 ScheduledAction(v8::Handle<v8::Context>, v8::Handle<v8::Function>, int argc, v8::Handle<v8::Value> argv[]); 48 ScheduledAction(v8::Handle<v8::Context>, v8::Handle<v8::Function>, int argc, v8::Handle<v8::Value> argv[], v8::Isolate*); 49 ScheduledAction(v8::Handle<v8::Context>, const String&, const KURL&, v8::Isolate*); 50 ~ScheduledAction(); 49 51 50 ScheduledAction(v8::Handle<v8::Context> context, const String& code, const KURL& url = KURL())51 : m_context(context)52 , m_code(code, url)53 {54 }55 56 ~ScheduledAction();57 52 void execute(ScriptExecutionContext*); 58 53 … … 67 62 Vector<v8::Persistent<v8::Value> > m_args; 68 63 ScriptSourceCode m_code; 64 v8::Isolate* m_isolate; 69 65 }; 70 66 -
trunk/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
r141977 r142565 122 122 // params is passed to action, and released in action's destructor 123 123 ASSERT(imp->frame()); 124 OwnPtr<ScheduledAction> action = adoptPtr(new ScheduledAction(imp->frame()->script()->currentWorldContext(), v8::Handle<v8::Function>::Cast(function), paramCount, params ));124 OwnPtr<ScheduledAction> action = adoptPtr(new ScheduledAction(imp->frame()->script()->currentWorldContext(), v8::Handle<v8::Function>::Cast(function), paramCount, params, args.GetIsolate())); 125 125 126 126 // FIXME: We should use OwnArrayPtr for params. … … 132 132 return v8Integer(0, args.GetIsolate()); 133 133 ASSERT(imp->frame()); 134 id = DOMTimer::install(scriptContext, adoptPtr(new ScheduledAction(imp->frame()->script()->currentWorldContext(), functionString )), timeout, singleShot);134 id = DOMTimer::install(scriptContext, adoptPtr(new ScheduledAction(imp->frame()->script()->currentWorldContext(), functionString, KURL(), args.GetIsolate())), timeout, singleShot); 135 135 } 136 136 -
trunk/Source/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp
r138665 r142565 71 71 } 72 72 WTF::String stringFunction = toWebCoreString(function); 73 timerId = DOMTimer::install(workerContext, adoptPtr(new ScheduledAction(v8Context, stringFunction, workerContext->url() )), timeout, singleShot);73 timerId = DOMTimer::install(workerContext, adoptPtr(new ScheduledAction(v8Context, stringFunction, workerContext->url(), args.GetIsolate())), timeout, singleShot); 74 74 } else if (function->IsFunction()) { 75 75 size_t paramCount = argumentCount >= 2 ? argumentCount - 2 : 0; … … 81 81 } 82 82 // ScheduledAction takes ownership of actual params and releases them in its destructor. 83 OwnPtr<ScheduledAction> action = adoptPtr(new ScheduledAction(v8Context, v8::Handle<v8::Function>::Cast(function), paramCount, params ));83 OwnPtr<ScheduledAction> action = adoptPtr(new ScheduledAction(v8Context, v8::Handle<v8::Function>::Cast(function), paramCount, params, args.GetIsolate())); 84 84 // FIXME: We should use a OwnArrayPtr for params. 85 85 delete [] params;
Note: See TracChangeset
for help on using the changeset viewer.