summaryrefslogtreecommitdiffstats
path: root/dom/flyweb/FlyWebServerEvents.cpp
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-02-06 19:49:46 -0500
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-04-14 12:35:06 +0200
commit8acff5cdbeb2f92be5e9e926b72ba4a1f19d425d (patch)
tree43bf1c75002befba8808ec03e2a9f2d1a4787d89 /dom/flyweb/FlyWebServerEvents.cpp
parent11a4ab0982caa3a4c22a08a72a134e2c402430ec (diff)
downloadUXP-8acff5cdbeb2f92be5e9e926b72ba4a1f19d425d.tar
UXP-8acff5cdbeb2f92be5e9e926b72ba4a1f19d425d.tar.gz
UXP-8acff5cdbeb2f92be5e9e926b72ba4a1f19d425d.tar.lz
UXP-8acff5cdbeb2f92be5e9e926b72ba4a1f19d425d.tar.xz
UXP-8acff5cdbeb2f92be5e9e926b72ba4a1f19d425d.zip
Issue #1395 - Part 2: Remove the rest of FlyWeb
Diffstat (limited to 'dom/flyweb/FlyWebServerEvents.cpp')
-rw-r--r--dom/flyweb/FlyWebServerEvents.cpp141
1 files changed, 0 insertions, 141 deletions
diff --git a/dom/flyweb/FlyWebServerEvents.cpp b/dom/flyweb/FlyWebServerEvents.cpp
deleted file mode 100644
index fe774ffb0..000000000
--- a/dom/flyweb/FlyWebServerEvents.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "mozilla/dom/EventBinding.h"
-#include "mozilla/dom/FlyWebFetchEventBinding.h"
-#include "mozilla/dom/FlyWebPublishedServer.h"
-#include "mozilla/dom/FlyWebServerEvents.h"
-#include "mozilla/dom/FlyWebWebSocketEventBinding.h"
-#include "mozilla/dom/Nullable.h"
-#include "mozilla/dom/Promise.h"
-#include "mozilla/dom/Response.h"
-
-#include "js/GCAPI.h"
-
-namespace mozilla {
-namespace dom {
-
-
-NS_IMPL_CYCLE_COLLECTION_CLASS(FlyWebFetchEvent)
-
-NS_IMPL_ADDREF_INHERITED(FlyWebFetchEvent, Event)
-NS_IMPL_RELEASE_INHERITED(FlyWebFetchEvent, Event)
-
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(FlyWebFetchEvent, Event)
- NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mRequest)
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
-
-NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(FlyWebFetchEvent, Event)
-NS_IMPL_CYCLE_COLLECTION_TRACE_END
-
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(FlyWebFetchEvent, Event)
- NS_IMPL_CYCLE_COLLECTION_UNLINK(mRequest)
-NS_IMPL_CYCLE_COLLECTION_UNLINK_END
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(FlyWebFetchEvent)
-NS_INTERFACE_MAP_END_INHERITING(Event)
-
-FlyWebFetchEvent::FlyWebFetchEvent(FlyWebPublishedServer* aServer,
- class Request* aRequest,
- InternalRequest* aInternalRequest)
- : Event(aServer, nullptr, nullptr)
- , mRequest(aRequest)
- , mInternalRequest(aInternalRequest)
- , mServer(aServer)
- , mResponded(false)
-{
- MOZ_ASSERT(aServer);
- MOZ_ASSERT(aRequest);
- MOZ_ASSERT(aInternalRequest);
-}
-
-FlyWebFetchEvent::~FlyWebFetchEvent()
-{
-}
-
-JSObject*
-FlyWebFetchEvent::WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
-{
- return FlyWebFetchEventBinding::Wrap(aCx, this, aGivenProto);
-}
-
-void
-FlyWebFetchEvent::RespondWith(Promise& aArg, ErrorResult& aRv)
-{
- if (mResponded) {
- aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
- return;
- }
-
- mResponded = true;
-
- aArg.AppendNativeHandler(this);
-}
-
-void
-FlyWebFetchEvent::ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue)
-{
- RefPtr<Response> response;
- if (aValue.isObject()) {
- UNWRAP_OBJECT(Response, &aValue.toObject(), response);
- }
-
- RefPtr<InternalResponse> intResponse;
- if (response && response->Type() != ResponseType::Opaque) {
- intResponse = response->GetInternalResponse();
- }
-
- if (!intResponse) {
- intResponse = InternalResponse::NetworkError();
- }
-
- NotifyServer(intResponse);
-}
-
-void
-FlyWebFetchEvent::NotifyServer(InternalResponse* aResponse)
-{
- mServer->OnFetchResponse(mInternalRequest, aResponse);
-}
-
-void
-FlyWebFetchEvent::RejectedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue)
-{
- RefPtr<InternalResponse> err = InternalResponse::NetworkError();
-
- NotifyServer(err);
-}
-
-JSObject*
-FlyWebWebSocketEvent::WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
-{
- return FlyWebWebSocketEventBinding::Wrap(aCx, this, aGivenProto);
-}
-
-already_AddRefed<WebSocket>
-FlyWebWebSocketEvent::Accept(const Optional<nsAString>& aProtocol,
- ErrorResult& aRv)
-{
- if (mResponded) {
- aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
- return nullptr;
- }
-
- mResponded = true;
-
- return mServer->OnWebSocketAccept(mInternalRequest, aProtocol, aRv);
-}
-
-
-void
-FlyWebWebSocketEvent::NotifyServer(InternalResponse* aResponse)
-{
- mServer->OnWebSocketResponse(mInternalRequest, aResponse);
-}
-
-
-} // namespace dom
-} // namespace mozilla