2015-05-03 12:32:37 -07: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 04:12:37 -07: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-26 22:16:40 -08:00
|
|
|
|
2011-07-17 12:09:13 -07:00
|
|
|
#ifndef mozilla_dom_workers_location_h__
|
|
|
|
#define mozilla_dom_workers_location_h__
|
|
|
|
|
|
|
|
#include "Workers.h"
|
2013-07-24 00:41:55 -07:00
|
|
|
#include "WorkerPrivate.h"
|
2013-09-29 21:15:37 -07:00
|
|
|
#include "nsWrapperCache.h"
|
2011-07-17 12:09:13 -07:00
|
|
|
|
|
|
|
BEGIN_WORKERS_NAMESPACE
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
class WorkerLocation final : public nsWrapperCache
|
2013-07-24 00:41:55 -07:00
|
|
|
{
|
|
|
|
nsString mHref;
|
|
|
|
nsString mProtocol;
|
|
|
|
nsString mHost;
|
|
|
|
nsString mHostname;
|
|
|
|
nsString mPort;
|
|
|
|
nsString mPathname;
|
|
|
|
nsString mSearch;
|
|
|
|
nsString mHash;
|
2014-01-31 10:22:52 -08:00
|
|
|
nsString mOrigin;
|
2011-07-17 12:09:13 -07:00
|
|
|
|
2013-09-29 21:15:37 -07:00
|
|
|
WorkerLocation(const nsAString& aHref,
|
2013-07-24 00:41:55 -07:00
|
|
|
const nsAString& aProtocol,
|
|
|
|
const nsAString& aHost,
|
|
|
|
const nsAString& aHostname,
|
|
|
|
const nsAString& aPort,
|
|
|
|
const nsAString& aPathname,
|
|
|
|
const nsAString& aSearch,
|
2014-01-31 10:22:52 -08:00
|
|
|
const nsAString& aHash,
|
|
|
|
const nsAString& aOrigin)
|
2013-09-29 21:15:37 -07:00
|
|
|
: mHref(aHref)
|
2013-07-24 00:41:55 -07:00
|
|
|
, mProtocol(aProtocol)
|
|
|
|
, mHost(aHost)
|
|
|
|
, mHostname(aHostname)
|
|
|
|
, mPort(aPort)
|
|
|
|
, mPathname(aPathname)
|
|
|
|
, mSearch(aSearch)
|
|
|
|
, mHash(aHash)
|
2014-01-31 10:22:52 -08:00
|
|
|
, mOrigin(aOrigin)
|
2013-07-24 00:41:55 -07:00
|
|
|
{
|
2013-09-29 21:15:37 -07:00
|
|
|
MOZ_COUNT_CTOR(WorkerLocation);
|
2013-07-24 00:41:55 -07:00
|
|
|
}
|
2011-07-17 12:09:13 -07:00
|
|
|
|
2014-06-23 12:56:07 -07:00
|
|
|
~WorkerLocation()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(WorkerLocation);
|
|
|
|
}
|
|
|
|
|
2013-07-24 00:41:55 -07:00
|
|
|
public:
|
2013-09-29 21:15:37 -07:00
|
|
|
|
|
|
|
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WorkerLocation)
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WorkerLocation)
|
|
|
|
|
2013-07-24 00:41:55 -07:00
|
|
|
static already_AddRefed<WorkerLocation>
|
2013-11-05 06:16:26 -08:00
|
|
|
Create(WorkerPrivate::LocationInfo& aInfo);
|
2011-07-17 12:09:13 -07:00
|
|
|
|
2013-09-29 21:15:37 -07:00
|
|
|
virtual JSObject*
|
2015-03-21 09:28:04 -07:00
|
|
|
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2013-07-24 00:41:55 -07:00
|
|
|
|
2013-09-29 21:15:37 -07:00
|
|
|
nsISupports* GetParentObject() const {
|
|
|
|
return nullptr;
|
|
|
|
}
|
2013-07-24 00:41:55 -07: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 10:22:52 -08:00
|
|
|
void GetOrigin(nsString& aOrigin) const
|
|
|
|
{
|
|
|
|
aOrigin = mOrigin;
|
|
|
|
}
|
2013-07-24 00:41:55 -07:00
|
|
|
};
|
2011-07-17 12:09:13 -07:00
|
|
|
|
|
|
|
END_WORKERS_NAMESPACE
|
|
|
|
|
|
|
|
#endif // mozilla_dom_workers_location_h__
|