Changeset 100347 in webkit
- Timestamp:
- Nov 15, 2011 3:34:04 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r100343 r100347 1 2011-11-15 Adam Klein <adamk@chromium.org> 2 3 Factor out V8Proxy's max recursion depth handling code 4 https://bugs.webkit.org/show_bug.cgi?id=72422 5 6 Reviewed by Nate Chapin. 7 8 Previously, V8Proxy used slightly different code to handle stack limit 9 violations depending on whether they occured in runScript or 10 callFunction. As described in http://webkit.org/b/72063, I intend to 11 expand the usage of m_recursion when calling into script. This patch 12 is intended to unify the existing handling code, making it easier to 13 move elsewhere without causing unintended side-effects. 14 15 No tests changed, as the only change in behavior is the string passed 16 to RangeError in the runScript case, and it's not mentioned anywhere 17 in the LayoutTests. 18 19 * bindings/v8/V8Proxy.cpp: 20 (WebCore::handleMaxRecursionDepthExceeded): 21 (WebCore::V8Proxy::runScript): Use callFunction's factored-out code. 22 (WebCore::V8Proxy::callFunction): Simplify and factor out code into handleMaxRecursionDepthExceeded. 23 1 24 2011-11-15 Jessie Berlin <jberlin@apple.com> 2 25 -
trunk/Source/WebCore/bindings/v8/V8Proxy.cpp
r100041 r100347 176 176 } 177 177 178 static v8::Local<v8::Value> handleMaxRecursionDepthExceeded() 179 { 180 v8::Local<v8::String> code = v8::String::New("throw new RangeError('Maximum call stack size exceeded.')"); 181 v8::Local<v8::Script> script = v8::Script::Compile(code); 182 script->Run(); 183 return v8::Local<v8::Value>(); 184 } 185 178 186 V8Proxy::V8Proxy(Frame* frame) 179 187 : m_frame(frame) … … 385 393 386 394 V8GCController::checkMemoryUsage(); 387 // Compute the source string and prevent against infinite recursion. 388 if (m_recursion >= kMaxRecursionDepth) { 389 v8::Local<v8::String> code = v8ExternalString("throw RangeError('Recursion too deep')"); 390 // FIXME: Ideally, we should be able to re-use the origin of the 391 // script passed to us as the argument instead of using an empty string 392 // and 0 baseLine. 393 script = compileScript(code, "", TextPosition::minimumPosition()); 394 } 395 if (m_recursion >= kMaxRecursionDepth) 396 return handleMaxRecursionDepthExceeded(); 395 397 396 398 if (handleOutOfMemory()) 397 399 ASSERT(script.IsEmpty()); 398 399 if (script.IsEmpty())400 return notHandledByInterceptor();401 400 402 401 // Save the previous value of the inlineCode flag and update the flag for … … 446 445 V8GCController::checkMemoryUsage(); 447 446 447 if (m_recursion >= kMaxRecursionDepth) 448 return handleMaxRecursionDepthExceeded(); 449 448 450 // Keep Frame (and therefore ScriptController and V8Proxy) alive. 449 451 RefPtr<Frame> protect(frame()); … … 451 453 v8::Local<v8::Value> result; 452 454 { 453 if (m_recursion >= kMaxRecursionDepth) {454 v8::Local<v8::String> code = v8::String::New("throw new RangeError('Maximum call stack size exceeded.')");455 if (code.IsEmpty())456 return result;457 v8::Local<v8::Script> script = v8::Script::Compile(code);458 if (script.IsEmpty())459 return result;460 script->Run();461 return result;462 }463 464 455 m_recursion++; 465 456 result = V8Proxy::instrumentedCallFunction(m_frame->page(), function, receiver, argc, args);
Note: See TracChangeset
for help on using the changeset viewer.