2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* 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/. */
|
2008-11-27 09:16:40 +03:00
|
|
|
|
2016-03-16 21:51:11 +03:00
|
|
|
#ifndef mozilla_dom_location_h__
|
|
|
|
#define mozilla_dom_location_h__
|
2011-07-17 23:09:13 +04:00
|
|
|
|
2018-01-30 12:10:04 +03:00
|
|
|
#include "WorkerCommon.h"
|
2013-07-24 11:41:55 +04:00
|
|
|
#include "WorkerPrivate.h"
|
2013-09-30 08:15:37 +04:00
|
|
|
#include "nsWrapperCache.h"
|
2011-07-17 23:09:13 +04:00
|
|
|
|
2016-03-16 21:51:11 +03:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2011-07-17 23:09:13 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class WorkerLocation final : public nsWrapperCache {
|
2013-07-24 11:41:55 +04:00
|
|
|
nsString mHref;
|
|
|
|
nsString mProtocol;
|
|
|
|
nsString mHost;
|
|
|
|
nsString mHostname;
|
|
|
|
nsString mPort;
|
|
|
|
nsString mPathname;
|
|
|
|
nsString mSearch;
|
|
|
|
nsString mHash;
|
2014-01-31 22:22:52 +04:00
|
|
|
nsString mOrigin;
|
2011-07-17 23:09:13 +04:00
|
|
|
|
2013-09-30 08:15:37 +04:00
|
|
|
WorkerLocation(const nsAString& aHref, const nsAString& aProtocol,
|
2013-07-24 11:41:55 +04:00
|
|
|
const nsAString& aHost, const nsAString& aHostname,
|
|
|
|
const nsAString& aPort, const nsAString& aPathname,
|
|
|
|
const nsAString& aSearch, const nsAString& aHash,
|
2014-01-31 22:22:52 +04:00
|
|
|
const nsAString& aOrigin)
|
2013-09-30 08:15:37 +04:00
|
|
|
: mHref(aHref),
|
2013-07-24 11:41:55 +04:00
|
|
|
mProtocol(aProtocol),
|
|
|
|
mHost(aHost),
|
|
|
|
mHostname(aHostname),
|
|
|
|
mPort(aPort),
|
|
|
|
mPathname(aPathname),
|
|
|
|
mSearch(aSearch),
|
|
|
|
mHash(aHash),
|
2014-01-31 22:22:52 +04:00
|
|
|
mOrigin(aOrigin) {
|
2013-09-30 08:15:37 +04:00
|
|
|
MOZ_COUNT_CTOR(WorkerLocation);
|
2013-07-24 11:41:55 +04:00
|
|
|
}
|
2011-07-17 23:09:13 +04:00
|
|
|
|
2014-06-23 23:56:07 +04:00
|
|
|
~WorkerLocation() { MOZ_COUNT_DTOR(WorkerLocation); }
|
2013-09-30 08:15:37 +04:00
|
|
|
|
2018-11-30 13:46:48 +03:00
|
|
|
public:
|
2013-09-30 08:15:37 +04:00
|
|
|
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WorkerLocation)
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WorkerLocation)
|
|
|
|
|
2013-07-24 11:41:55 +04:00
|
|
|
static already_AddRefed<WorkerLocation> Create(
|
2018-01-31 10:24:08 +03:00
|
|
|
WorkerPrivate::LocationInfo& aInfo);
|
2011-07-17 23:09:13 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aGivenProto) override;
|
2013-07-24 11:41:55 +04:00
|
|
|
|
2013-09-30 08:15:37 +04:00
|
|
|
nsISupports* GetParentObject() const { return nullptr; }
|
2013-07-24 11:41:55 +04:00
|
|
|
|
|
|
|
void Stringify(nsString& aHref) const { aHref = mHref; }
|
|
|
|
void GetHref(nsString& aHref) const { aHref = mHref; }
|
|
|
|
void GetProtocol(nsString& aProtocol) const { aProtocol = mProtocol; }
|
|
|
|
void GetHost(nsString& aHost) const { aHost = mHost; }
|
|
|
|
void GetHostname(nsString& aHostname) const { aHostname = mHostname; }
|
|
|
|
void GetPort(nsString& aPort) const { aPort = mPort; }
|
|
|
|
void GetPathname(nsString& aPathname) const { aPathname = mPathname; }
|
|
|
|
void GetSearch(nsString& aSearch) const { aSearch = mSearch; }
|
|
|
|
void GetHash(nsString& aHash) const { aHash = mHash; }
|
2014-01-31 22:22:52 +04:00
|
|
|
void GetOrigin(nsString& aOrigin) const { aOrigin = mOrigin; }
|
2013-07-24 11:41:55 +04:00
|
|
|
};
|
2011-07-17 23:09:13 +04:00
|
|
|
|
2016-03-16 21:51:11 +03:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2011-07-17 23:09:13 +04:00
|
|
|
|
2016-03-16 21:51:11 +03:00
|
|
|
#endif // mozilla_dom_location_h__
|