Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Unified Diff: Source/bindings/v8/ScriptDebugServer.cpp

Issue 100963003: Use V8TRYCATCH_FOR_V8STRINGRESOURCE() macro instead of toCoreStringWithUndefinedOrNullCheck() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove toCoreString(v8::Handle<v8::Value> value) Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/bindings/v8/ScriptDebugServer.cpp
diff --git a/Source/bindings/v8/ScriptDebugServer.cpp b/Source/bindings/v8/ScriptDebugServer.cpp
index ee11d9ef1322dc98d3d4ed43b2825d55dfe3c9df..3f385e35a19d01f1e48d88c6b53c47cf73d24026 100644
--- a/Source/bindings/v8/ScriptDebugServer.cpp
+++ b/Source/bindings/v8/ScriptDebugServer.cpp
@@ -298,13 +298,23 @@ bool ScriptDebugServer::setScriptSource(const String& sourceID, const String& ne
// Compile error.
case 1:
{
+ V8StringResource<WithUndefinedOrNullCheck> message(resultTuple->Get(2));
+ if (!message.prepare()) {
+ *error = "Unknown error.";
+ return false;
+ }
RefPtr<TypeBuilder::Debugger::SetScriptSourceError::CompileError> compileError =
TypeBuilder::Debugger::SetScriptSourceError::CompileError::create()
- .setMessage(toCoreStringWithUndefinedOrNullCheck(resultTuple->Get(2)))
+ .setMessage(message)
pfeldman 2013/12/12 16:11:24 Same here, we know it is a string. See https://cod
.setLineNumber(resultTuple->Get(3)->ToInteger()->Value())
.setColumnNumber(resultTuple->Get(4)->ToInteger()->Value());
- *error = toCoreStringWithUndefinedOrNullCheck(resultTuple->Get(1));
+ V8StringResource<WithUndefinedOrNullCheck> errorResource(resultTuple->Get(1));
pfeldman 2013/12/12 16:11:24 ditto
+ if (!errorResource.prepare()) {
+ *error = "Unknown error.";
+ return false;
+ }
+ *error = errorResource;
errorData = TypeBuilder::Debugger::SetScriptSourceError::create();
errorData->setCompileError(compileError);
return false;
@@ -383,8 +393,10 @@ void ScriptDebugServer::handleProgramBreak(v8::Handle<v8::Object> executionState
Vector<String> breakpointIds;
if (!hitBreakpointNumbers.IsEmpty()) {
breakpointIds.resize(hitBreakpointNumbers->Length());
- for (size_t i = 0; i < hitBreakpointNumbers->Length(); i++)
- breakpointIds[i] = toCoreStringWithUndefinedOrNullCheck(hitBreakpointNumbers->Get(i));
+ for (size_t i = 0; i < hitBreakpointNumbers->Length(); i++) {
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithUndefinedOrNullCheck>, hitBreakpointNumber, hitBreakpointNumbers->Get(i));
+ breakpointIds[i] = hitBreakpointNumber;
+ }
}
m_executionState.set(m_isolate, executionState);
@@ -488,12 +500,15 @@ void ScriptDebugServer::handleV8DebugEvent(const v8::Debug::EventDetails& eventD
void ScriptDebugServer::dispatchDidParseSource(ScriptDebugListener* listener, v8::Handle<v8::Object> object)
{
- String sourceID = toCoreStringWithUndefinedOrNullCheck(object->Get(v8AtomicString(m_isolate, "id")));
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithUndefinedOrNullCheck>, sourceID, object->Get(v8AtomicString(m_isolate, "id")));
pfeldman 2013/12/12 16:11:24 These are of known types: https://code.google.com/
ScriptDebugListener::Script script;
- script.url = toCoreStringWithUndefinedOrNullCheck(object->Get(v8AtomicString(m_isolate, "name")));
- script.source = toCoreStringWithUndefinedOrNullCheck(object->Get(v8AtomicString(m_isolate, "source")));
- script.sourceMappingURL = toCoreStringWithUndefinedOrNullCheck(object->Get(v8AtomicString(m_isolate, "sourceMappingURL")));
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithUndefinedOrNullCheck>, url, object->Get(v8AtomicString(m_isolate, "name")));
+ script.url = url;
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithUndefinedOrNullCheck>, source, object->Get(v8AtomicString(m_isolate, "source")));
+ script.source = source;
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithUndefinedOrNullCheck>, sourceMappingURL, object->Get(v8AtomicString(m_isolate, "sourceMappingURL")));
+ script.sourceMappingURL = sourceMappingURL;
pfeldman 2013/12/12 16:11:24 Hm. This seems NULL. Adding vsevik for this.
script.startLine = object->Get(v8AtomicString(m_isolate, "startLine"))->ToInteger()->Value();
script.startColumn = object->Get(v8AtomicString(m_isolate, "startColumn"))->ToInteger()->Value();
script.endLine = object->Get(v8AtomicString(m_isolate, "endLine"))->ToInteger()->Value();

Powered by Google App Engine
This is Rietveld 408576698