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

Side by Side Diff: Source/core/inspector/JavaScriptCallFrame.cpp

Issue 98853012: Revert of Remove uses of deprecated toWebCoreStringWithUndefinedOrNullCheck(v8::Handle<v8::Value>) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « Source/bindings/v8/custom/V8WindowCustom.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010, Google Inc. All rights reserved. 2 * Copyright (c) 2010, 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 if (result->IsInt32()) 90 if (result->IsInt32())
91 return result->Int32Value(); 91 return result->Int32Value();
92 return 0; 92 return 0;
93 } 93 }
94 94
95 String JavaScriptCallFrame::functionName() const 95 String JavaScriptCallFrame::functionName() const
96 { 96 {
97 v8::HandleScope handleScope(m_isolate); 97 v8::HandleScope handleScope(m_isolate);
98 v8::Context::Scope contextScope(m_debuggerContext.newLocal(m_isolate)); 98 v8::Context::Scope contextScope(m_debuggerContext.newLocal(m_isolate));
99 v8::Handle<v8::Value> result = m_callFrame.newLocal(m_isolate)->Get(v8Atomic String(m_isolate, "functionName")); 99 v8::Handle<v8::Value> result = m_callFrame.newLocal(m_isolate)->Get(v8Atomic String(m_isolate, "functionName"));
100 V8TRYCATCH_FOR_V8STRINGRESOURCE_RETURN(V8StringResource<WithUndefinedOrNullC heck>, name, result, String()); 100 return toWebCoreStringWithUndefinedOrNullCheck(result);
101 return name;
102 } 101 }
103 102
104 v8::Handle<v8::Value> JavaScriptCallFrame::scopeChain() const 103 v8::Handle<v8::Value> JavaScriptCallFrame::scopeChain() const
105 { 104 {
106 v8::Handle<v8::Array> scopeChain = v8::Handle<v8::Array>::Cast(m_callFrame.n ewLocal(m_isolate)->Get(v8AtomicString(m_isolate, "scopeChain"))); 105 v8::Handle<v8::Array> scopeChain = v8::Handle<v8::Array>::Cast(m_callFrame.n ewLocal(m_isolate)->Get(v8AtomicString(m_isolate, "scopeChain")));
107 v8::Handle<v8::Array> result = v8::Array::New(m_isolate, scopeChain->Length( )); 106 v8::Handle<v8::Array> result = v8::Array::New(m_isolate, scopeChain->Length( ));
108 for (uint32_t i = 0; i < scopeChain->Length(); i++) 107 for (uint32_t i = 0; i < scopeChain->Length(); i++)
109 result->Set(i, scopeChain->Get(i)); 108 result->Set(i, scopeChain->Get(i));
110 return result; 109 return result;
111 } 110 }
112 111
113 int JavaScriptCallFrame::scopeType(int scopeIndex) const 112 int JavaScriptCallFrame::scopeType(int scopeIndex) const
114 { 113 {
115 v8::Handle<v8::Array> scopeType = v8::Handle<v8::Array>::Cast(m_callFrame.ne wLocal(m_isolate)->Get(v8AtomicString(m_isolate, "scopeType"))); 114 v8::Handle<v8::Array> scopeType = v8::Handle<v8::Array>::Cast(m_callFrame.ne wLocal(m_isolate)->Get(v8AtomicString(m_isolate, "scopeType")));
116 return scopeType->Get(scopeIndex)->Int32Value(); 115 return scopeType->Get(scopeIndex)->Int32Value();
117 } 116 }
118 117
119 v8::Handle<v8::Value> JavaScriptCallFrame::thisObject() const 118 v8::Handle<v8::Value> JavaScriptCallFrame::thisObject() const
120 { 119 {
121 return m_callFrame.newLocal(m_isolate)->Get(v8AtomicString(m_isolate, "thisO bject")); 120 return m_callFrame.newLocal(m_isolate)->Get(v8AtomicString(m_isolate, "thisO bject"));
122 } 121 }
123 122
124 String JavaScriptCallFrame::stepInPositions() const 123 String JavaScriptCallFrame::stepInPositions() const
125 { 124 {
126 v8::Handle<v8::Object> callFrame = m_callFrame.newLocal(m_isolate); 125 v8::Handle<v8::Object> callFrame = m_callFrame.newLocal(m_isolate);
127 v8::Handle<v8::Function> stepInPositions = v8::Handle<v8::Function>::Cast(ca llFrame->Get(v8AtomicString(m_isolate, "stepInPositions"))); 126 v8::Handle<v8::Function> stepInPositions = v8::Handle<v8::Function>::Cast(ca llFrame->Get(v8AtomicString(m_isolate, "stepInPositions")));
128 v8::Handle<v8::Value> result = stepInPositions->Call(callFrame, 0, 0); 127 v8::Handle<v8::Value> result = stepInPositions->Call(callFrame, 0, 0);
129 V8TRYCATCH_FOR_V8STRINGRESOURCE_RETURN(V8StringResource<WithUndefinedOrNullC heck>, resultString, result, String()); 128 return toWebCoreStringWithUndefinedOrNullCheck(result);
130 return resultString;
131 } 129 }
132 130
133 bool JavaScriptCallFrame::isAtReturn() const 131 bool JavaScriptCallFrame::isAtReturn() const
134 { 132 {
135 v8::HandleScope handleScope(m_isolate); 133 v8::HandleScope handleScope(m_isolate);
136 v8::Context::Scope contextScope(m_debuggerContext.newLocal(m_isolate)); 134 v8::Context::Scope contextScope(m_debuggerContext.newLocal(m_isolate));
137 v8::Handle<v8::Value> result = m_callFrame.newLocal(m_isolate)->Get(v8Atomic String(m_isolate, "isAtReturn")); 135 v8::Handle<v8::Value> result = m_callFrame.newLocal(m_isolate)->Get(v8Atomic String(m_isolate, "isAtReturn"));
138 if (result->IsBoolean()) 136 if (result->IsBoolean())
139 return result->BooleanValue(); 137 return result->BooleanValue();
140 return false; 138 return false;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 v8::Handle<v8::Function> setVariableValueFunction = v8::Handle<v8::Function> ::Cast(callFrame->Get(v8AtomicString(m_isolate, "setVariableValue"))); 172 v8::Handle<v8::Function> setVariableValueFunction = v8::Handle<v8::Function> ::Cast(callFrame->Get(v8AtomicString(m_isolate, "setVariableValue")));
175 v8::Handle<v8::Value> argv[] = { 173 v8::Handle<v8::Value> argv[] = {
176 v8::Handle<v8::Value>(v8::Integer::New(scopeNumber, m_isolate)), 174 v8::Handle<v8::Value>(v8::Integer::New(scopeNumber, m_isolate)),
177 v8String(m_isolate, variableName), 175 v8String(m_isolate, variableName),
178 newValue.v8Value() 176 newValue.v8Value()
179 }; 177 };
180 return ScriptValue(setVariableValueFunction->Call(callFrame, 3, argv), m_iso late); 178 return ScriptValue(setVariableValueFunction->Call(callFrame, 3, argv), m_iso late);
181 } 179 }
182 180
183 } // namespace WebCore 181 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/custom/V8WindowCustom.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698