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
|
|
|
|
2011-07-17 23:09:13 +04:00
|
|
|
#ifndef mozilla_dom_workers_location_h__
|
|
|
|
#define mozilla_dom_workers_location_h__
|
|
|
|
|
|
|
|
#include "Workers.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
|
|
|
|
|
|
|
BEGIN_WORKERS_NAMESPACE
|
|
|
|
|
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,
|
2013-07-24 11:41:55 +04:00
|
|
|
const nsAString& aProtocol,
|
|
|
|
const nsAString& aHost,
|
|
|
|
const nsAString& aHostname,
|
|
|
|
const nsAString& aPort,
|
|
|
|
const nsAString& aPathname,
|
|
|
|
const nsAString& aSearch,
|
2014-01-31 22:22:52 +04:00
|
|
|
const nsAString& aHash,
|
|
|
|
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-07-24 11:41:55 +04:00
|
|
|
{
|
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-07-24 11:41:55 +04: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>
|
2013-11-05 18:16:26 +04:00
|
|
|
Create(WorkerPrivate::LocationInfo& aInfo);
|
2011-07-17 23:09:13 +04:00
|
|
|
|
2013-09-30 08:15:37 +04:00
|
|
|
virtual JSObject*
|
2015-03-21 19:28:04 +03:00
|
|
|
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
|
|
|
|
|
|
|
END_WORKERS_NAMESPACE
|
|
|
|
|
|
|
|
#endif // mozilla_dom_workers_location_h__
|