| OLD | NEW |
| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 139 |
| 140 void InjectedScript::releaseObject(const String16& objectId) | 140 void InjectedScript::releaseObject(const String16& objectId) |
| 141 { | 141 { |
| 142 std::unique_ptr<protocol::Value> parsedObjectId = protocol::parseJSON(object
Id); | 142 std::unique_ptr<protocol::Value> parsedObjectId = protocol::parseJSON(object
Id); |
| 143 if (!parsedObjectId) | 143 if (!parsedObjectId) |
| 144 return; | 144 return; |
| 145 protocol::DictionaryValue* object = protocol::DictionaryValue::cast(parsedOb
jectId.get()); | 145 protocol::DictionaryValue* object = protocol::DictionaryValue::cast(parsedOb
jectId.get()); |
| 146 if (!object) | 146 if (!object) |
| 147 return; | 147 return; |
| 148 int boundId = 0; | 148 int boundId = 0; |
| 149 if (!object->getNumber("id", &boundId)) | 149 if (!object->getInteger("id", &boundId)) |
| 150 return; | 150 return; |
| 151 m_native->unbind(boundId); | 151 m_native->unbind(boundId); |
| 152 } | 152 } |
| 153 | 153 |
| 154 std::unique_ptr<protocol::Runtime::RemoteObject> InjectedScript::wrapObject(Erro
rString* errorString, v8::Local<v8::Value> value, const String16& groupName, boo
l forceValueType, bool generatePreview) const | 154 std::unique_ptr<protocol::Runtime::RemoteObject> InjectedScript::wrapObject(Erro
rString* errorString, v8::Local<v8::Value> value, const String16& groupName, boo
l forceValueType, bool generatePreview) const |
| 155 { | 155 { |
| 156 v8::HandleScope handles(m_context->isolate()); | 156 v8::HandleScope handles(m_context->isolate()); |
| 157 v8::Local<v8::Value> wrappedObject; | 157 v8::Local<v8::Value> wrappedObject; |
| 158 if (!wrapValue(errorString, value, groupName, forceValueType, generatePrevie
w).ToLocal(&wrappedObject)) | 158 if (!wrapValue(errorString, value, groupName, forceValueType, generatePrevie
w).ToLocal(&wrappedObject)) |
| 159 return nullptr; | 159 return nullptr; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 } | 302 } |
| 303 return object; | 303 return object; |
| 304 } | 304 } |
| 305 return v8::Undefined(m_context->isolate()); | 305 return v8::Undefined(m_context->isolate()); |
| 306 } | 306 } |
| 307 | 307 |
| 308 std::unique_ptr<protocol::Runtime::ExceptionDetails> InjectedScript::createExcep
tionDetails(v8::Local<v8::Message> message) | 308 std::unique_ptr<protocol::Runtime::ExceptionDetails> InjectedScript::createExcep
tionDetails(v8::Local<v8::Message> message) |
| 309 { | 309 { |
| 310 std::unique_ptr<protocol::Runtime::ExceptionDetails> exceptionDetailsObject
= protocol::Runtime::ExceptionDetails::create().setText(toProtocolString(message
->Get())).build(); | 310 std::unique_ptr<protocol::Runtime::ExceptionDetails> exceptionDetailsObject
= protocol::Runtime::ExceptionDetails::create().setText(toProtocolString(message
->Get())).build(); |
| 311 exceptionDetailsObject->setUrl(toProtocolStringWithTypeCheck(message->GetScr
iptResourceName())); | 311 exceptionDetailsObject->setUrl(toProtocolStringWithTypeCheck(message->GetScr
iptResourceName())); |
| 312 exceptionDetailsObject->setScriptId(String16::number(message->GetScriptOrigi
n().ScriptID()->Value())); | 312 exceptionDetailsObject->setScriptId(String16::fromInteger(message->GetScript
Origin().ScriptID()->Value())); |
| 313 | 313 |
| 314 v8::Maybe<int> lineNumber = message->GetLineNumber(m_context->context()); | 314 v8::Maybe<int> lineNumber = message->GetLineNumber(m_context->context()); |
| 315 if (lineNumber.IsJust()) | 315 if (lineNumber.IsJust()) |
| 316 exceptionDetailsObject->setLineNumber(lineNumber.FromJust() - 1); | 316 exceptionDetailsObject->setLineNumber(lineNumber.FromJust() - 1); |
| 317 v8::Maybe<int> columnNumber = message->GetStartColumn(m_context->context()); | 317 v8::Maybe<int> columnNumber = message->GetStartColumn(m_context->context()); |
| 318 if (columnNumber.IsJust()) | 318 if (columnNumber.IsJust()) |
| 319 exceptionDetailsObject->setColumnNumber(columnNumber.FromJust()); | 319 exceptionDetailsObject->setColumnNumber(columnNumber.FromJust()); |
| 320 | 320 |
| 321 v8::Local<v8::StackTrace> stackTrace = message->GetStackTrace(); | 321 v8::Local<v8::StackTrace> stackTrace = message->GetStackTrace(); |
| 322 if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) | 322 if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 void InjectedScript::CallFrameScope::findInjectedScript(V8InspectorSessionImpl*
session) | 492 void InjectedScript::CallFrameScope::findInjectedScript(V8InspectorSessionImpl*
session) |
| 493 { | 493 { |
| 494 std::unique_ptr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(m_err
orString, m_remoteCallFrameId); | 494 std::unique_ptr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(m_err
orString, m_remoteCallFrameId); |
| 495 if (!remoteId) | 495 if (!remoteId) |
| 496 return; | 496 return; |
| 497 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal()); | 497 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal()); |
| 498 m_injectedScript = session->findInjectedScript(m_errorString, remoteId.get()
); | 498 m_injectedScript = session->findInjectedScript(m_errorString, remoteId.get()
); |
| 499 } | 499 } |
| 500 | 500 |
| 501 } // namespace blink | 501 } // namespace blink |
| OLD | NEW |