Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010-2011 Google Inc. All rights reserved. | 2 * Copyright (c) 2010-2011 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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 291 if (normalResult->IsObject()) | 291 if (normalResult->IsObject()) |
| 292 *result = ScriptObject(ScriptState::current(), normalResult->ToO bject()); | 292 *result = ScriptObject(ScriptState::current(), normalResult->ToO bject()); |
| 293 // Call stack may have changed after if the edited function was on t he stack. | 293 // Call stack may have changed after if the edited function was on t he stack. |
| 294 if (!preview && isPaused()) | 294 if (!preview && isPaused()) |
| 295 *newCallFrames = currentCallFrames(); | 295 *newCallFrames = currentCallFrames(); |
| 296 return true; | 296 return true; |
| 297 } | 297 } |
| 298 // Compile error. | 298 // Compile error. |
| 299 case 1: | 299 case 1: |
| 300 { | 300 { |
| 301 V8StringResource<WithUndefinedOrNullCheck> message(resultTuple->Get( 2)); | |
| 302 if (!message.prepare()) { | |
| 303 *error = "Unknown error."; | |
| 304 return false; | |
| 305 } | |
| 301 RefPtr<TypeBuilder::Debugger::SetScriptSourceError::CompileError> co mpileError = | 306 RefPtr<TypeBuilder::Debugger::SetScriptSourceError::CompileError> co mpileError = |
| 302 TypeBuilder::Debugger::SetScriptSourceError::CompileError::creat e() | 307 TypeBuilder::Debugger::SetScriptSourceError::CompileError::creat e() |
| 303 .setMessage(toCoreStringWithUndefinedOrNullCheck(resultTuple ->Get(2))) | 308 .setMessage(message) |
|
pfeldman
2013/12/12 16:11:24
Same here, we know it is a string. See https://cod
| |
| 304 .setLineNumber(resultTuple->Get(3)->ToInteger()->Value()) | 309 .setLineNumber(resultTuple->Get(3)->ToInteger()->Value()) |
| 305 .setColumnNumber(resultTuple->Get(4)->ToInteger()->Value()); | 310 .setColumnNumber(resultTuple->Get(4)->ToInteger()->Value()); |
| 306 | 311 |
| 307 *error = toCoreStringWithUndefinedOrNullCheck(resultTuple->Get(1)); | 312 V8StringResource<WithUndefinedOrNullCheck> errorResource(resultTuple ->Get(1)); |
|
pfeldman
2013/12/12 16:11:24
ditto
| |
| 313 if (!errorResource.prepare()) { | |
| 314 *error = "Unknown error."; | |
| 315 return false; | |
| 316 } | |
| 317 *error = errorResource; | |
| 308 errorData = TypeBuilder::Debugger::SetScriptSourceError::create(); | 318 errorData = TypeBuilder::Debugger::SetScriptSourceError::create(); |
| 309 errorData->setCompileError(compileError); | 319 errorData->setCompileError(compileError); |
| 310 return false; | 320 return false; |
| 311 } | 321 } |
| 312 } | 322 } |
| 313 *error = "Unknown error."; | 323 *error = "Unknown error."; |
| 314 return false; | 324 return false; |
| 315 } | 325 } |
| 316 | 326 |
| 317 PassRefPtr<JavaScriptCallFrame> ScriptDebugServer::wrapCallFrames(v8::Handle<v8: :Object> executionState, int maximumLimit) | 327 PassRefPtr<JavaScriptCallFrame> ScriptDebugServer::wrapCallFrames(v8::Handle<v8: :Object> executionState, int maximumLimit) |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 376 if (isPaused()) | 386 if (isPaused()) |
| 377 return; | 387 return; |
| 378 | 388 |
| 379 ScriptDebugListener* listener = getDebugListenerForContext(m_pausedContext); | 389 ScriptDebugListener* listener = getDebugListenerForContext(m_pausedContext); |
| 380 if (!listener) | 390 if (!listener) |
| 381 return; | 391 return; |
| 382 | 392 |
| 383 Vector<String> breakpointIds; | 393 Vector<String> breakpointIds; |
| 384 if (!hitBreakpointNumbers.IsEmpty()) { | 394 if (!hitBreakpointNumbers.IsEmpty()) { |
| 385 breakpointIds.resize(hitBreakpointNumbers->Length()); | 395 breakpointIds.resize(hitBreakpointNumbers->Length()); |
| 386 for (size_t i = 0; i < hitBreakpointNumbers->Length(); i++) | 396 for (size_t i = 0; i < hitBreakpointNumbers->Length(); i++) { |
| 387 breakpointIds[i] = toCoreStringWithUndefinedOrNullCheck(hitBreakpoin tNumbers->Get(i)); | 397 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithUndefinedO rNullCheck>, hitBreakpointNumber, hitBreakpointNumbers->Get(i)); |
| 398 breakpointIds[i] = hitBreakpointNumber; | |
| 399 } | |
| 388 } | 400 } |
| 389 | 401 |
| 390 m_executionState.set(m_isolate, executionState); | 402 m_executionState.set(m_isolate, executionState); |
| 391 ScriptState* currentCallFrameState = ScriptState::forContext(m_pausedContext ); | 403 ScriptState* currentCallFrameState = ScriptState::forContext(m_pausedContext ); |
| 392 listener->didPause(currentCallFrameState, currentCallFrames(), ScriptValue(e xception, currentCallFrameState->isolate()), breakpointIds); | 404 listener->didPause(currentCallFrameState, currentCallFrames(), ScriptValue(e xception, currentCallFrameState->isolate()), breakpointIds); |
| 393 | 405 |
| 394 m_runningNestedMessageLoop = true; | 406 m_runningNestedMessageLoop = true; |
| 395 runMessageLoopOnPause(m_pausedContext); | 407 runMessageLoopOnPause(m_pausedContext); |
| 396 m_runningNestedMessageLoop = false; | 408 m_runningNestedMessageLoop = false; |
| 397 } | 409 } |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 481 skipRequest = listener->shouldSkipStepPause(topFrame); | 493 skipRequest = listener->shouldSkipStepPause(topFrame); |
| 482 if (executeSkipPauseRequest(skipRequest, eventDetails.GetExecutionSt ate())) | 494 if (executeSkipPauseRequest(skipRequest, eventDetails.GetExecutionSt ate())) |
| 483 return; | 495 return; |
| 484 handleProgramBreak(eventDetails, v8::Handle<v8::Value>(), hitBreakpo ints.As<v8::Array>()); | 496 handleProgramBreak(eventDetails, v8::Handle<v8::Value>(), hitBreakpo ints.As<v8::Array>()); |
| 485 } | 497 } |
| 486 } | 498 } |
| 487 } | 499 } |
| 488 | 500 |
| 489 void ScriptDebugServer::dispatchDidParseSource(ScriptDebugListener* listener, v8 ::Handle<v8::Object> object) | 501 void ScriptDebugServer::dispatchDidParseSource(ScriptDebugListener* listener, v8 ::Handle<v8::Object> object) |
| 490 { | 502 { |
| 491 String sourceID = toCoreStringWithUndefinedOrNullCheck(object->Get(v8AtomicS tring(m_isolate, "id"))); | 503 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithUndefinedOrNullChe ck>, sourceID, object->Get(v8AtomicString(m_isolate, "id"))); |
|
pfeldman
2013/12/12 16:11:24
These are of known types: https://code.google.com/
| |
| 492 | 504 |
| 493 ScriptDebugListener::Script script; | 505 ScriptDebugListener::Script script; |
| 494 script.url = toCoreStringWithUndefinedOrNullCheck(object->Get(v8AtomicString (m_isolate, "name"))); | 506 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithUndefinedOrNullChe ck>, url, object->Get(v8AtomicString(m_isolate, "name"))); |
| 495 script.source = toCoreStringWithUndefinedOrNullCheck(object->Get(v8AtomicStr ing(m_isolate, "source"))); | 507 script.url = url; |
| 496 script.sourceMappingURL = toCoreStringWithUndefinedOrNullCheck(object->Get(v 8AtomicString(m_isolate, "sourceMappingURL"))); | 508 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithUndefinedOrNullChe ck>, source, object->Get(v8AtomicString(m_isolate, "source"))); |
| 509 script.source = source; | |
| 510 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithUndefinedOrNullChe ck>, sourceMappingURL, object->Get(v8AtomicString(m_isolate, "sourceMappingURL") )); | |
| 511 script.sourceMappingURL = sourceMappingURL; | |
|
pfeldman
2013/12/12 16:11:24
Hm. This seems NULL. Adding vsevik for this.
| |
| 497 script.startLine = object->Get(v8AtomicString(m_isolate, "startLine"))->ToIn teger()->Value(); | 512 script.startLine = object->Get(v8AtomicString(m_isolate, "startLine"))->ToIn teger()->Value(); |
| 498 script.startColumn = object->Get(v8AtomicString(m_isolate, "startColumn"))-> ToInteger()->Value(); | 513 script.startColumn = object->Get(v8AtomicString(m_isolate, "startColumn"))-> ToInteger()->Value(); |
| 499 script.endLine = object->Get(v8AtomicString(m_isolate, "endLine"))->ToIntege r()->Value(); | 514 script.endLine = object->Get(v8AtomicString(m_isolate, "endLine"))->ToIntege r()->Value(); |
| 500 script.endColumn = object->Get(v8AtomicString(m_isolate, "endColumn"))->ToIn teger()->Value(); | 515 script.endColumn = object->Get(v8AtomicString(m_isolate, "endColumn"))->ToIn teger()->Value(); |
| 501 script.isContentScript = object->Get(v8AtomicString(m_isolate, "isContentScr ipt"))->ToBoolean()->Value(); | 516 script.isContentScript = object->Get(v8AtomicString(m_isolate, "isContentScr ipt"))->ToBoolean()->Value(); |
| 502 | 517 |
| 503 listener->didParseSource(sourceID, script); | 518 listener->didParseSource(sourceID, script); |
| 504 } | 519 } |
| 505 | 520 |
| 506 void ScriptDebugServer::ensureDebuggerScriptCompiled() | 521 void ScriptDebugServer::ensureDebuggerScriptCompiled() |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 617 { | 632 { |
| 618 return PassOwnPtr<ScriptSourceCode>(); | 633 return PassOwnPtr<ScriptSourceCode>(); |
| 619 } | 634 } |
| 620 | 635 |
| 621 String ScriptDebugServer::preprocessEventListener(Frame*, const String& source, const String& url, const String& functionName) | 636 String ScriptDebugServer::preprocessEventListener(Frame*, const String& source, const String& url, const String& functionName) |
| 622 { | 637 { |
| 623 return source; | 638 return source; |
| 624 } | 639 } |
| 625 | 640 |
| 626 } // namespace WebCore | 641 } // namespace WebCore |
| OLD | NEW |