RefPtr<FetchResponse> FetchResponse::clone(ScriptExecutionContext& context, ExceptionCode& ec) { if (isDisturbed()) { ec = TypeError; return nullptr; } return adoptRef(*new FetchResponse(context, FetchBody(m_body), FetchHeaders::create(headers()), ResourceResponse(m_response))); }
RefPtr<FetchRequest> FetchRequest::clone(ScriptExecutionContext& context, ExceptionCode& ec) { if (isDisturbed()) { ec = TypeError; return nullptr; } // FIXME: Validate body teeing. return adoptRef(*new FetchRequest(context, FetchBody(m_body), FetchHeaders::create(m_headers.get()), FetchRequest::InternalRequest(m_internalRequest))); }
ReadableStreamSource* FetchResponse::createReadableStreamSource() { ASSERT(!m_readableStreamSource); ASSERT(!isDisturbed()); if (body().isEmpty()) return nullptr; m_readableStreamSource = adoptRef(*new FetchResponseSource(*this)); return m_readableStreamSource.get(); }