1 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_dom_workers_location_h__
7 #define mozilla_dom_workers_location_h__
10 #include "WorkerPrivate.h"
11 #include "nsWrapperCache.h"
13 BEGIN_WORKERS_NAMESPACE
15 class WorkerLocation MOZ_FINAL
: public nsWrapperCache
26 WorkerLocation(const nsAString
& aHref
,
27 const nsAString
& aProtocol
,
28 const nsAString
& aHost
,
29 const nsAString
& aHostname
,
30 const nsAString
& aPort
,
31 const nsAString
& aPathname
,
32 const nsAString
& aSearch
,
33 const nsAString
& aHash
)
35 , mProtocol(aProtocol
)
37 , mHostname(aHostname
)
39 , mPathname(aPathname
)
43 MOZ_COUNT_CTOR(WorkerLocation
);
49 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WorkerLocation
)
50 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WorkerLocation
)
52 static already_AddRefed
<WorkerLocation
>
53 Create(WorkerPrivate::LocationInfo
& aInfo
);
56 WrapObject(JSContext
* aCx
, JS::Handle
<JSObject
*> aScope
) MOZ_OVERRIDE
;
58 nsISupports
* GetParentObject() const {
64 MOZ_COUNT_DTOR(WorkerLocation
);
67 void Stringify(nsString
& aHref
) const
71 void GetHref(nsString
& aHref
) const
75 void GetProtocol(nsString
& aProtocol
) const
77 aProtocol
= mProtocol
;
79 void GetHost(nsString
& aHost
) const
83 void GetHostname(nsString
& aHostname
) const
85 aHostname
= mHostname
;
87 void GetPort(nsString
& aPort
) const
91 void GetPathname(nsString
& aPathname
) const
93 aPathname
= mPathname
;
95 void GetSearch(nsString
& aSearch
) const
99 void GetHash(nsString
& aHash
) const
105 END_WORKERS_NAMESPACE
107 #endif // mozilla_dom_workers_location_h__