void InspectorBackend::removeNode(long callId, long nodeId) { InspectorFrontend* frontend = inspectorFrontend(); if (!frontend) return; Node* node = nodeForId(nodeId); if (!node) { // Use -1 to denote an error condition. frontend->didRemoveNode(callId, -1); return; } Node* parentNode = node->parentNode(); if (!parentNode) { frontend->didRemoveNode(callId, -1); return; } ExceptionCode code; parentNode->removeChild(node, code); if (code) { frontend->didRemoveNode(callId, -1); return; } frontend->didRemoveNode(callId, nodeId); }
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); }
void InspectorBackend::getResourceContent(long callId, unsigned long identifier) { InspectorFrontend* frontend = inspectorFrontend(); if (!frontend) return; RefPtr<InspectorResource> resource = m_inspectorController->resources().get(identifier); if (resource) frontend->didGetResourceContent(callId, resource->sourceString()); else frontend->didGetResourceContent(callId, ""); }
void InspectorBackend::getDatabaseTableNames(long callId, long databaseId) { if (InspectorFrontend* frontend = inspectorFrontend()) { ScriptArray result = frontend->newScriptArray(); Database* database = m_inspectorController->databaseForId(databaseId); if (database) { Vector<String> tableNames = database->tableNames(); unsigned length = tableNames.size(); for (unsigned i = 0; i < length; ++i) result.set(i, tableNames[i]); } frontend->didGetDatabaseTableNames(callId, result); } }
void InspectorBackend::setPauseOnExceptionsState(long pauseState) { ScriptDebugServer::shared().setPauseOnExceptionsState(static_cast<ScriptDebugServer::PauseOnExceptionsState>(pauseState)); if (InspectorFrontend* frontend = inspectorFrontend()) frontend->updatePauseOnExceptionsState(ScriptDebugServer::shared().pauseOnExceptionsState()); }