Files
palemoon27/dom/fetch/Request.h
T
roytam1 9e4ed9857d import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1183825 - Hide PushMessageData methods until we support sending push data. r=mt,smaug (c07f6b6c9)
- Bug 1186880 - Performance timing api in workers should output entries if preference is enabled. r=baku (642bd335a)
- Bug 1188091 - Fix the exposure of Push interfaces; r=dougt,bzbarsky,nsm Currently we don't check the dom.push.enabled pref in some cases for some of these interfaces.  This patch unifies how all of these interfaces are exposed to Window, Worker, and ServiceWorker. (dbe4ebfcc)
- Bug 1188062 - Unship Request.context; r=baku (6ca2ebcf6)
- Bug 1162714 - Don't let YCM generate machc. r=ehsan (7c5f36c12)
- Bug 1160897 - Fixing .ycm_extra_conf for Fennec. r=ehsan (22adf0705)
- goanna->gecko (94b69bd6c)
- improve (e87b53162)
- Bug 1147939 - The expression decompiler can't assume that it's called directly from script. (r=bhackett) (4759a5210)
- Bug 1188609 - Remove mirroring support from RokuApp (Toolkit) r=snorp (81a0bb66a)
- Bug 1050749 - Expose BatteryManager via getBattery() returning a Promise. r=bz, r=baku, r=jgraham (67d2dd502)
- Bug 1182347 - Remove nsIPrincipal::cookieJar. r=sicking (855d0e8ce)
- remove double method, probably misspach (3c256c5b4)
- Bug 1182357 - Add an API to mint nsExpandedPrincipals. r=mrbkap (42de17cfd)
- Bug 1172080 - Part 1: Throw when requesting origin for poorly behaved URIs, r=bholley (c8410f3c6)
- Bug 1124126 - Retry database connection for the case of corrupted permissions.sqlite. r=bsmedberg (748e9205a)
2021-12-23 09:44:29 +08:00

135 lines
2.8 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
#ifndef mozilla_dom_Request_h
#define mozilla_dom_Request_h
#include "nsIContentPolicy.h"
#include "nsISupportsImpl.h"
#include "nsWrapperCache.h"
#include "mozilla/dom/Fetch.h"
#include "mozilla/dom/InternalRequest.h"
// Required here due to certain WebIDL enums/classes being declared in both
// files.
#include "mozilla/dom/RequestBinding.h"
namespace mozilla {
namespace dom {
class Headers;
class InternalHeaders;
class RequestOrUSVString;
class Request final : public nsISupports
, public FetchBody<Request>
, public nsWrapperCache
{
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Request)
public:
Request(nsIGlobalObject* aOwner, InternalRequest* aRequest);
static bool
RequestContextEnabled(JSContext* aCx, JSObject* aObj);
JSObject*
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
{
return RequestBinding::Wrap(aCx, this, aGivenProto);
}
void
GetUrl(nsAString& aUrl) const
{
CopyUTF8toUTF16(mRequest->mURL, aUrl);
}
void
GetMethod(nsCString& aMethod) const
{
aMethod = mRequest->mMethod;
}
RequestMode
Mode() const
{
if (mRequest->mMode == RequestMode::Cors_with_forced_preflight) {
return RequestMode::Cors;
}
return mRequest->mMode;
}
RequestCredentials
Credentials() const
{
return mRequest->mCredentialsMode;
}
RequestCache
Cache() const
{
return mRequest->GetCacheMode();
}
RequestContext
Context() const
{
return mRequest->Context();
}
void
SetContentPolicyType(nsContentPolicyType aContentPolicyType)
{
mRequest->SetContentPolicyType(aContentPolicyType);
}
void
GetReferrer(nsAString& aReferrer) const
{
mRequest->GetReferrer(aReferrer);
}
InternalHeaders*
GetInternalHeaders() const
{
return mRequest->Headers();
}
Headers* Headers_();
void
GetBody(nsIInputStream** aStream) { return mRequest->GetBody(aStream); }
static already_AddRefed<Request>
Constructor(const GlobalObject& aGlobal, const RequestOrUSVString& aInput,
const RequestInit& aInit, ErrorResult& rv);
nsIGlobalObject* GetParentObject() const
{
return mOwner;
}
already_AddRefed<Request>
Clone(ErrorResult& aRv) const;
already_AddRefed<InternalRequest>
GetInternalRequest();
private:
~Request();
nsCOMPtr<nsIGlobalObject> mOwner;
nsRefPtr<InternalRequest> mRequest;
// Lazily created.
nsRefPtr<Headers> mHeaders;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_Request_h