void InspectorAnimationAgent::resolveAnimation(ErrorString* errorString, const String& animationId, RefPtr<TypeBuilder::Runtime::RemoteObject>& result) { Animation* animation = assertAnimation(errorString, animationId); if (!animation) return; if (m_idToAnimationClone.get(animationId)) animation = m_idToAnimationClone.get(animationId); const Element* element = toKeyframeEffect(animation->effect())->target(); Document* document = element->ownerDocument(); LocalFrame* frame = document ? document->frame() : nullptr; if (!frame) { *errorString = "Element not associated with a document."; return; } ScriptState* scriptState = ScriptState::forMainWorld(frame); InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(scriptState); if (injectedScript.isEmpty()) return; ScriptState::Scope scope(scriptState); v8::Isolate* isolate = scriptState->isolate(); ScriptValue scriptValue = ScriptValue(scriptState, toV8(animation, scriptState->context()->Global(), isolate)); injectedScript.releaseObjectGroup("animation"); result = injectedScript.wrapObject(scriptValue, "animation"); }