void ConsoleMessage::addToFrontend(InspectorFrontend::Console* frontend, InjectedScriptManager* injectedScriptManager) { RefPtr<TypeBuilder::Console::ConsoleMessage> jsonObj = TypeBuilder::Console::ConsoleMessage::create() .setSource(messageSourceValue(m_source)) .setLevel(messageLevelValue(m_level)) .setText(m_message); // FIXME: only send out type for ConsoleAPI source messages. jsonObj->setType(messageTypeValue(m_type)); jsonObj->setLine(static_cast<int>(m_line)); jsonObj->setUrl(m_url); jsonObj->setRepeatCount(static_cast<int>(m_repeatCount)); if (m_source == NetworkMessageSource && !m_requestId.isEmpty()) jsonObj->setNetworkRequestId(m_requestId); if (m_arguments && m_arguments->argumentCount()) { InjectedScript injectedScript = injectedScriptManager->injectedScriptFor(m_arguments->globalState()); if (!injectedScript.hasNoValue()) { RefPtr<InspectorArray> jsonArgs = InspectorArray::create(); for (unsigned i = 0; i < m_arguments->argumentCount(); ++i) { RefPtr<InspectorValue> inspectorValue = injectedScript.wrapObject(m_arguments->argumentAt(i), "console"); if (!inspectorValue) { ASSERT_NOT_REACHED(); return; } jsonArgs->pushValue(inspectorValue); } jsonObj->setParameters(jsonArgs); } } if (m_callStack) jsonObj->setStackTrace(m_callStack->buildInspectorArray()); frontend->messageAdded(jsonObj); }
void InspectorRuntimeAgent::callFunctionOn(ErrorString* errorString, const String& objectId, const String& expression, const RefPtr<InspectorArray>* const optionalArguments, const bool* const doNotPauseOnExceptionsAndMuteConsole, const bool* const returnByValue, const bool* generatePreview, RefPtr<Inspector::TypeBuilder::Runtime::RemoteObject>& result, Inspector::TypeBuilder::OptOutput<bool>* wasThrown) { InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId); if (injectedScript.hasNoValue()) { *errorString = "Inspected frame has gone"; return; } String arguments; if (optionalArguments) arguments = (*optionalArguments)->toJSONString(); #if ENABLE(JAVASCRIPT_DEBUGGER) ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = ScriptDebugServer::DontPauseOnExceptions; if (asBool(doNotPauseOnExceptionsAndMuteConsole)) previousPauseOnExceptionsState = setPauseOnExceptionsState(m_scriptDebugServer, ScriptDebugServer::DontPauseOnExceptions); #endif if (asBool(doNotPauseOnExceptionsAndMuteConsole)) muteConsole(); injectedScript.callFunctionOn(errorString, objectId, expression, arguments, asBool(returnByValue), asBool(generatePreview), &result, wasThrown); if (asBool(doNotPauseOnExceptionsAndMuteConsole)) { unmuteConsole(); #if ENABLE(JAVASCRIPT_DEBUGGER) setPauseOnExceptionsState(m_scriptDebugServer, previousPauseOnExceptionsState); #endif } }
void InspectorHeapAgent::getRemoteObject(ErrorString& errorString, int heapObjectId, const String* optionalObjectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result) { // Prevent the cell from getting collected as we look it up. VM& vm = m_environment.vm(); JSLockHolder lock(vm); DeferGC deferGC(vm.heap); unsigned heapObjectIdentifier = static_cast<unsigned>(heapObjectId); const std::optional<HeapSnapshotNode> optionalNode = nodeForHeapObjectIdentifier(errorString, heapObjectIdentifier); if (!optionalNode) return; JSCell* cell = optionalNode->cell; Structure* structure = cell->structure(vm); if (!structure) { errorString = ASCIILiteral("Unable to get object details"); return; } JSGlobalObject* globalObject = structure->globalObject(); if (!globalObject) { errorString = ASCIILiteral("Unable to get object details"); return; } InjectedScript injectedScript = m_injectedScriptManager.injectedScriptFor(globalObject->globalExec()); if (injectedScript.hasNoValue()) { errorString = ASCIILiteral("Unable to get object details - InjectedScript"); return; } String objectGroup = optionalObjectGroup ? *optionalObjectGroup : String(); result = injectedScript.wrapObject(cell, objectGroup, true); }
void InspectorRuntimeAgent::evaluate(ErrorString* errorString, const String& expression, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const doNotPauseOnExceptions, const String* const frameId, const bool* const returnByValue, RefPtr<InspectorObject>* result, bool* wasThrown) { ScriptState* scriptState = 0; if (frameId) { scriptState = scriptStateForFrameId(*frameId); if (!scriptState) { *errorString = "Frame with given id not found."; return; } } else scriptState = getDefaultInspectedState(); InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(scriptState); if (injectedScript.hasNoValue()) { *errorString = "Inspected frame has gone"; return; } #if ENABLE(JAVASCRIPT_DEBUGGER) ASSERT(m_scriptDebugServer); bool pauseStateChanged = false; ScriptDebugServer::PauseOnExceptionsState presentState = m_scriptDebugServer->pauseOnExceptionsState(); if (asBool(doNotPauseOnExceptions) && presentState != ScriptDebugServer::DontPauseOnExceptions) { m_scriptDebugServer->setPauseOnExceptionsState(ScriptDebugServer::DontPauseOnExceptions); pauseStateChanged = true; } #endif injectedScript.evaluate(errorString, expression, objectGroup ? *objectGroup : "", asBool(includeCommandLineAPI), asBool(returnByValue), result, wasThrown); #if ENABLE(JAVASCRIPT_DEBUGGER) if (pauseStateChanged) m_scriptDebugServer->setPauseOnExceptionsState(presentState); #endif }
void InspectorDebuggerAgent::runScript(ErrorString* errorString, const ScriptId& scriptId, const int* executionContextId, const String* const objectGroup, const bool* const doNotPauseOnExceptionsAndMuteConsole, RefPtr<TypeBuilder::Runtime::RemoteObject>& result, TypeBuilder::OptOutput<bool>* wasThrown) { InjectedScript injectedScript = injectedScriptForEval(errorString, executionContextId); if (injectedScript.hasNoValue()) { *errorString = "Inspected frame has gone"; return; } ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = scriptDebugServer().pauseOnExceptionsState(); if (doNotPauseOnExceptionsAndMuteConsole && *doNotPauseOnExceptionsAndMuteConsole) { if (previousPauseOnExceptionsState != ScriptDebugServer::DontPauseOnExceptions) scriptDebugServer().setPauseOnExceptionsState(ScriptDebugServer::DontPauseOnExceptions); muteConsole(); } ScriptValue value; bool wasThrownValue; String exceptionMessage; scriptDebugServer().runScript(injectedScript.scriptState(), scriptId, &value, &wasThrownValue, &exceptionMessage); *wasThrown = wasThrownValue; if (value.hasNoValue()) { *errorString = "Script execution failed"; return; } result = injectedScript.wrapObject(value, objectGroup ? *objectGroup : ""); if (wasThrownValue) result->setDescription(exceptionMessage); if (doNotPauseOnExceptionsAndMuteConsole && *doNotPauseOnExceptionsAndMuteConsole) { unmuteConsole(); if (scriptDebugServer().pauseOnExceptionsState() != previousPauseOnExceptionsState) scriptDebugServer().setPauseOnExceptionsState(previousPauseOnExceptionsState); } }
void InspectorRuntimeAgent::callFunctionOn(ErrorString& errorString, const String& objectId, const String& expression, const InspectorArray* optionalArguments, const bool* const doNotPauseOnExceptionsAndMuteConsole, const bool* const returnByValue, const bool* generatePreview, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>* wasThrown) { InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId); if (injectedScript.hasNoValue()) { errorString = ASCIILiteral("Could not find InjectedScript for objectId"); return; } String arguments; if (optionalArguments) arguments = optionalArguments->toJSONString(); ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = ScriptDebugServer::DontPauseOnExceptions; if (asBool(doNotPauseOnExceptionsAndMuteConsole)) previousPauseOnExceptionsState = setPauseOnExceptionsState(m_scriptDebugServer, ScriptDebugServer::DontPauseOnExceptions); if (asBool(doNotPauseOnExceptionsAndMuteConsole)) muteConsole(); injectedScript.callFunctionOn(errorString, objectId, expression, arguments, asBool(returnByValue), asBool(generatePreview), &result, wasThrown); if (asBool(doNotPauseOnExceptionsAndMuteConsole)) { unmuteConsole(); setPauseOnExceptionsState(m_scriptDebugServer, previousPauseOnExceptionsState); } }
void ConsoleMessage::addToFrontend(InspectorFrontend* frontend, InjectedScriptHost* injectedScriptHost) { RefPtr<InspectorObject> jsonObj = InspectorObject::create(); jsonObj->setNumber("source", static_cast<int>(m_source)); jsonObj->setNumber("type", static_cast<int>(m_type)); jsonObj->setNumber("level", static_cast<int>(m_level)); jsonObj->setNumber("line", static_cast<int>(m_line)); jsonObj->setString("url", m_url); jsonObj->setNumber("repeatCount", static_cast<int>(m_repeatCount)); jsonObj->setString("message", m_message); if (m_type == NetworkErrorMessageType) jsonObj->setNumber("requestId", m_requestId); if (m_arguments && m_arguments->argumentCount()) { InjectedScript injectedScript = injectedScriptHost->injectedScriptFor(m_arguments->globalState()); if (!injectedScript.hasNoValue()) { RefPtr<InspectorArray> jsonArgs = InspectorArray::create(); for (unsigned i = 0; i < m_arguments->argumentCount(); ++i) { RefPtr<InspectorValue> inspectorValue = injectedScript.wrapForConsole(m_arguments->argumentAt(i)); if (!inspectorValue) { ASSERT_NOT_REACHED(); return; } jsonArgs->pushValue(inspectorValue); } jsonObj->setArray("parameters", jsonArgs); } } if (m_callStack) jsonObj->setArray("stackTrace", m_callStack->buildInspectorObject()); frontend->addConsoleMessage(jsonObj); }
void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString* errorString, const String& callFrameId, const String& expression, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const doNotPauseOnExceptionsAndMuteConsole, const bool* const returnByValue, const bool* generatePreview, RefPtr<TypeBuilder::Runtime::RemoteObject>& result, TypeBuilder::OptOutput<bool>* wasThrown) { if (!isPaused() || m_currentCallStack.isNull()) { *errorString = "Attempt to access callframe when debugger is not on pause"; return; } InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(callFrameId); if (injectedScript.hasNoValue()) { *errorString = "Inspected frame has gone"; return; } ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = scriptDebugServer().pauseOnExceptionsState(); if (doNotPauseOnExceptionsAndMuteConsole ? *doNotPauseOnExceptionsAndMuteConsole : false) { if (previousPauseOnExceptionsState != ScriptDebugServer::DontPauseOnExceptions) scriptDebugServer().setPauseOnExceptionsState(ScriptDebugServer::DontPauseOnExceptions); muteConsole(); } injectedScript.evaluateOnCallFrame(errorString, m_currentCallStack, callFrameId, expression, objectGroup ? *objectGroup : "", includeCommandLineAPI ? *includeCommandLineAPI : false, returnByValue ? *returnByValue : false, generatePreview ? *generatePreview : false, &result, wasThrown); if (doNotPauseOnExceptionsAndMuteConsole ? *doNotPauseOnExceptionsAndMuteConsole : false) { unmuteConsole(); if (scriptDebugServer().pauseOnExceptionsState() != previousPauseOnExceptionsState) scriptDebugServer().setPauseOnExceptionsState(previousPauseOnExceptionsState); } }
void InspectorDebuggerAgent::setVariableValue(ErrorString* errorString, int scopeNumber, const String& variableName, const RefPtr<JSONObject>& newValue, const String* callFrameId, const String* functionObjectId) { InjectedScript injectedScript; if (callFrameId) { if (!isPaused() || m_currentCallStack.isNull()) { *errorString = "Attempt to access callframe when debugger is not on pause"; return; } injectedScript = m_injectedScriptManager->injectedScriptForObjectId(*callFrameId); if (injectedScript.hasNoValue()) { *errorString = "Inspected frame has gone"; return; } } else if (functionObjectId) { injectedScript = m_injectedScriptManager->injectedScriptForObjectId(*functionObjectId); if (injectedScript.hasNoValue()) { *errorString = "Function object id cannot be resolved"; return; } } else { *errorString = "Either call frame or function object must be specified"; return; } String newValueString = newValue->toJSONString(); injectedScript.setVariableValue(errorString, m_currentCallStack, callFrameId, functionObjectId, scopeNumber, variableName, newValueString); }
void InspectorDebuggerAgent::didPause(ScriptState* scriptState, const ScriptValue& callFrames, const ScriptValue& exception) { ASSERT(scriptState && !m_pausedScriptState); m_pausedScriptState = scriptState; m_currentCallStack = callFrames; if (!exception.hasNoValue()) { InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(scriptState); if (!injectedScript.hasNoValue()) { m_breakReason = InspectorFrontend::Debugger::Reason::Exception; m_breakAuxData = injectedScript.wrapObject(exception, "backtrace")->openAccessors(); // m_breakAuxData might be null after this. } } m_frontend->paused(currentCallFrames(), m_breakReason, m_breakAuxData); m_javaScriptPauseScheduled = false; if (!m_continueToLocationBreakpointId.isEmpty()) { scriptDebugServer().removeBreakpoint(m_continueToLocationBreakpointId); m_continueToLocationBreakpointId = ""; } if (m_listener) m_listener->didPause(); }
void InspectorBackend::dispatchOnInjectedScript(long callId, long injectedScriptId, const String& methodName, const String& arguments, bool async) { InspectorFrontend* frontend = inspectorFrontend(); if (!frontend) return; // FIXME: explicitly pass injectedScriptId along with node id to the frontend. bool injectedScriptIdIsNodeId = injectedScriptId <= 0; InjectedScript injectedScript; if (injectedScriptIdIsNodeId) injectedScript = m_inspectorController->injectedScriptForNodeId(-injectedScriptId); else injectedScript = m_inspectorController->injectedScriptHost()->injectedScriptForId(injectedScriptId); if (injectedScript.hasNoValue()) return; RefPtr<SerializedScriptValue> result; bool hadException = false; injectedScript.dispatch(callId, methodName, arguments, async, &result, &hadException); if (async) return; // InjectedScript will return result asynchronously by means of ::reportDidDispatchOnInjectedScript. frontend->didDispatchOnInjectedScript(callId, result.get(), hadException); }
Ref<Inspector::Protocol::Array<Inspector::Protocol::Debugger::CallFrame>> InspectorDebuggerAgent::currentCallFrames(InjectedScript injectedScript) { ASSERT(!injectedScript.hasNoValue()); if (injectedScript.hasNoValue()) return Inspector::Protocol::Array<Inspector::Protocol::Debugger::CallFrame>::create(); return injectedScript.wrapCallFrames(m_currentCallStack); }
void InspectorRuntimeAgent::setPropertyValue(ErrorString* errorString, const String& objectId, const String& propertyName, const String& expression) { InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId); if (!injectedScript.hasNoValue()) injectedScript.setPropertyValue(errorString, objectId, propertyName, expression); else *errorString = "No injected script found"; }
void InspectorRuntimeAgent::evaluate(ErrorString* errorString, const String& expression, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const doNotPauseOnExceptionsAndMuteConsole, const int* executionContextId, const bool* const returnByValue, const bool* generatePreview, RefPtr<TypeBuilder::Runtime::RemoteObject>& result, TypeBuilder::OptOutput<bool>* wasThrown, RefPtr<TypeBuilder::Debugger::ExceptionDetails>& exceptionDetails) { InjectedScript injectedScript = injectedScriptForEval(errorString, executionContextId); if (injectedScript.isEmpty()) return; InjectedScriptCallScope callScope(this, asBool(doNotPauseOnExceptionsAndMuteConsole)); injectedScript.evaluate(errorString, expression, objectGroup ? *objectGroup : "", asBool(includeCommandLineAPI), asBool(returnByValue), asBool(generatePreview), &result, wasThrown, &exceptionDetails); }
void InspectorDebuggerAgent::getFunctionDetails(ErrorString* errorString, const String& functionId, RefPtr<TypeBuilder::Debugger::FunctionDetails>& details) { InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(functionId); if (injectedScript.hasNoValue()) { *errorString = "Function object id is obsolete"; return; } injectedScript.getFunctionDetails(errorString, functionId, &details); }
void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString* errorString, const String& callFrameId, const String& expression, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const returnByValue, RefPtr<InspectorObject>& result, bool* wasThrown) { InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(callFrameId); if (injectedScript.hasNoValue()) { *errorString = "Inspected frame has gone"; return; } injectedScript.evaluateOnCallFrame(errorString, m_currentCallStack, callFrameId, expression, objectGroup ? *objectGroup : "", includeCommandLineAPI ? *includeCommandLineAPI : false, returnByValue ? *returnByValue : false, &result, wasThrown); }
void InspectorRuntimeAgent::evaluateOn(ErrorString* errorString, const String& objectId, const String& expression, RefPtr<InspectorObject>* result, bool* wasThrown) { InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId); if (injectedScript.hasNoValue()) { *errorString = "Inspected frame has gone"; return; } injectedScript.evaluateOn(errorString, objectId, expression, result, wasThrown); }
void InspectorDebuggerAgent::getFunctionDetails(ErrorString* errorString, const String& functionId, RefPtr<InspectorObject>& details) { InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(functionId); if (injectedScript.hasNoValue()) { *errorString = "Inspected frame has gone"; return; } injectedScript.getFunctionDetails(errorString, functionId, &details); }
void InspectorRuntimeAgent::getProperties(ErrorString* errorString, const String& objectId, bool ignoreHasOwnProperty, RefPtr<InspectorArray>* result) { InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId); if (injectedScript.hasNoValue()) { *errorString = "Inspected frame has gone"; return; } injectedScript.getProperties(errorString, objectId, ignoreHasOwnProperty, result); }
void InspectorRuntimeAgent::evaluate(ErrorString* errorString, const String& expression, const String* const objectGroup, const bool* const includeCommandLineAPI, RefPtr<InspectorObject>* result, bool* wasThrown) { InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(getDefaultInspectedState()); if (injectedScript.hasNoValue()) { *errorString = "Inspected frame has gone"; return; } injectedScript.evaluate(errorString, expression, objectGroup ? *objectGroup : "", includeCommandLineAPI ? *includeCommandLineAPI : false, result, wasThrown); }
void InspectorDebuggerAgent::getFunctionDetails(ErrorString& errorString, const String& functionId, RefPtr<Inspector::Protocol::Debugger::FunctionDetails>& details) { InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(functionId); if (injectedScript.hasNoValue()) { errorString = ASCIILiteral("Function object id is obsolete"); return; } injectedScript.getFunctionDetails(errorString, functionId, &details); }
InjectedScript WorkerDebuggerAgent::injectedScriptForEval(ErrorString* error, const int* executionContextId) { if (!executionContextId) return injectedScriptManager()->injectedScriptFor(m_inspectedWorkerGlobalScope->script()->scriptState()); InjectedScript injectedScript = injectedScriptManager()->injectedScriptForId(*executionContextId); if (injectedScript.isEmpty()) *error = "Execution context with given id not found."; return injectedScript; }
void InjectedScriptModule::ensureInjected(InjectedScriptManager* injectedScriptManager, InjectedScript injectedScript) { ASSERT(!injectedScript.hasNoValue()); if (injectedScript.hasNoValue()) return; // FIXME: Make the InjectedScript a module itself. JSC::APIEntryShim entryShim(injectedScript.scriptState()); Deprecated::ScriptFunctionCall function(injectedScript.injectedScriptObject(), ASCIILiteral("module"), injectedScriptManager->inspectorEnvironment().functionCallHandler()); function.appendArgument(name()); bool hadException = false; Deprecated::ScriptValue resultValue = injectedScript.callFunctionWithEvalEnabled(function, hadException); ASSERT(!hadException); if (hadException || resultValue.hasNoValue() || !resultValue.isObject()) { Deprecated::ScriptFunctionCall function(injectedScript.injectedScriptObject(), ASCIILiteral("injectModule"), injectedScriptManager->inspectorEnvironment().functionCallHandler()); function.appendArgument(name()); function.appendArgument(source()); function.appendArgument(host(injectedScriptManager, injectedScript.scriptState())); resultValue = injectedScript.callFunctionWithEvalEnabled(function, hadException); if (hadException || (returnsObject() && (resultValue.hasNoValue() || !resultValue.isObject()))) { ASSERT_NOT_REACHED(); return; } } if (returnsObject()) { Deprecated::ScriptObject moduleObject(injectedScript.scriptState(), resultValue); initialize(moduleObject, &injectedScriptManager->inspectorEnvironment()); } }
InjectedScriptCanvasModule InspectorCanvasAgent::injectedScriptCanvasModule(ErrorString* errorString, const String& objectId) { if (!checkIsEnabled(errorString)) return InjectedScriptCanvasModule(); InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId); if (injectedScript.hasNoValue()) { *errorString = "Inspected frame has gone"; return InjectedScriptCanvasModule(); } return injectedScriptCanvasModule(errorString, injectedScript.scriptState()); }
PassRefPtr<Array<TypeBuilder::Debugger::CallFrame>> InspectorDebuggerAgent::currentCallFrames() { if (!m_pausedScriptState) return Array<TypeBuilder::Debugger::CallFrame>::create(); InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(m_pausedScriptState); if (injectedScript.hasNoValue()) { ASSERT_NOT_REACHED(); return Array<TypeBuilder::Debugger::CallFrame>::create(); } return injectedScript.wrapCallFrames(m_currentCallStack); }
InjectedScript PageDebuggerAgent::injectedScriptForEval(ErrorString* errorString, const int* executionContextId) { if (!executionContextId) { JSC::ExecState* scriptState = mainWorldExecState(m_pageAgent->mainFrame()); return injectedScriptManager()->injectedScriptFor(scriptState); } InjectedScript injectedScript = injectedScriptManager()->injectedScriptForId(*executionContextId); if (injectedScript.hasNoValue()) *errorString = "Execution context with given id not found."; return injectedScript; }
PassRefPtr<InspectorValue> InspectorDebuggerAgent::currentCallFrames() { if (!m_pausedScriptState) return InspectorValue::null(); InjectedScript injectedScript = m_inspectorController->injectedScriptHost()->injectedScriptFor(m_pausedScriptState); if (injectedScript.hasNoValue()) { ASSERT_NOT_REACHED(); return InspectorValue::null(); } return injectedScript.callFrames(); }
InjectedScript JSGlobalObjectRuntimeAgent::injectedScriptForEval(ErrorString* errorString, const int* executionContextId) { ASSERT_UNUSED(executionContextId, !executionContextId); JSC::ExecState* scriptState = m_globalObject.globalExec(); InjectedScript injectedScript = injectedScriptManager()->injectedScriptFor(scriptState); if (injectedScript.hasNoValue()) *errorString = ASCIILiteral("Internal error: main world execution context not found."); return injectedScript; }
RefPtr<InspectorObject> InspectorDebuggerAgent::buildExceptionPauseReason(const Deprecated::ScriptValue& exception, const InjectedScript& injectedScript) { ASSERT(!exception.hasNoValue()); if (exception.hasNoValue()) return nullptr; ASSERT(!injectedScript.hasNoValue()); if (injectedScript.hasNoValue()) return nullptr; return injectedScript.wrapObject(exception, InspectorDebuggerAgent::backtraceObjectGroup)->openAccessors(); }
void InspectorRuntimeAgent::callFunctionOn(ErrorString* errorString, const String& objectId, const String& expression, const RefPtr<InspectorArray>* const optionalArguments, const bool* const returnByValue, RefPtr<InspectorObject>* result, bool* wasThrown) { InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId); if (injectedScript.hasNoValue()) { *errorString = "Inspected frame has gone"; return; } String arguments; if (optionalArguments) arguments = (*optionalArguments)->toJSONString(); injectedScript.callFunctionOn(errorString, objectId, expression, arguments, asBool(returnByValue), result, wasThrown); }