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

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

Issue 1021713003: [bindings] Let NativeValueTraits<T>::nativeValue be variadic function and merge various convers… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed the compiler error behind ASSERT flag Created 5 years, 9 months 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 if (isEmpty() || !canAccessInspectedWindow()) { 159 if (isEmpty() || !canAccessInspectedWindow()) {
160 *result = JSONValue::null(); 160 *result = JSONValue::null();
161 return; 161 return;
162 } 162 }
163 163
164 bool hadException = false; 164 bool hadException = false;
165 ScriptValue resultValue = callFunctionWithEvalEnabled(function, hadException ); 165 ScriptValue resultValue = callFunctionWithEvalEnabled(function, hadException );
166 166
167 ASSERT(!hadException); 167 ASSERT(!hadException);
168 if (!hadException) { 168 if (!hadException) {
169 *result = resultValue.toJSONValue(m_injectedScriptObject.scriptState()); 169 ScriptState* scriptState = m_injectedScriptObject.scriptState();
170 ScriptState::Scope scope(scriptState);
171 NonThrowableExceptionState exceptionState;
172 *result = ScriptValue::to<JSONValuePtr>(scriptState->isolate(), resultVa lue, exceptionState);
170 if (!*result) 173 if (!*result)
171 *result = JSONString::create(String::format("Object has too long ref erence chain(must not be longer than %d)", JSONValue::maxDepth)); 174 *result = JSONString::create(String::format("Object has too long ref erence chain(must not be longer than %d)", JSONValue::maxDepth));
172 } else { 175 } else {
173 *result = JSONString::create("Exception while making a call."); 176 *result = JSONString::create("Exception while making a call.");
174 } 177 }
175 } 178 }
176 179
177 void InjectedScriptBase::makeEvalCall(ErrorString* errorString, ScriptFunctionCa ll& function, RefPtr<TypeBuilder::Runtime::RemoteObject>* objectResult, TypeBuil der::OptOutput<bool>* wasThrown, RefPtr<TypeBuilder::Debugger::ExceptionDetails> * exceptionDetails) 180 void InjectedScriptBase::makeEvalCall(ErrorString* errorString, ScriptFunctionCa ll& function, RefPtr<TypeBuilder::Runtime::RemoteObject>* objectResult, TypeBuil der::OptOutput<bool>* wasThrown, RefPtr<TypeBuilder::Debugger::ExceptionDetails> * exceptionDetails)
178 { 181 {
179 RefPtr<JSONValue> result; 182 RefPtr<JSONValue> result;
(...skipping 21 matching lines...) Expand all
201 if (wasThrownVal) { 204 if (wasThrownVal) {
202 RefPtr<JSONObject> objectExceptionDetails = resultPair->getObject("excep tionDetails"); 205 RefPtr<JSONObject> objectExceptionDetails = resultPair->getObject("excep tionDetails");
203 if (objectExceptionDetails) 206 if (objectExceptionDetails)
204 *exceptionDetails = toExceptionDetails(objectExceptionDetails.releas e()); 207 *exceptionDetails = toExceptionDetails(objectExceptionDetails.releas e());
205 } 208 }
206 *objectResult = TypeBuilder::Runtime::RemoteObject::runtimeCast(resultObj); 209 *objectResult = TypeBuilder::Runtime::RemoteObject::runtimeCast(resultObj);
207 *wasThrown = wasThrownVal; 210 *wasThrown = wasThrownVal;
208 } 211 }
209 212
210 } // namespace blink 213 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698