Backed out changeset 3fe07c50c854 (bug 946316) for bustage. a=backout
[gecko.git] / dom / workers / Location.h
blobb132cd6e50db963593de1dcff12a3d02628103df
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__
9 #include "Workers.h"
10 #include "WorkerPrivate.h"
11 #include "nsWrapperCache.h"
13 BEGIN_WORKERS_NAMESPACE
15 class WorkerLocation MOZ_FINAL : public nsWrapperCache
17 nsString mHref;
18 nsString mProtocol;
19 nsString mHost;
20 nsString mHostname;
21 nsString mPort;
22 nsString mPathname;
23 nsString mSearch;
24 nsString mHash;
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)
34 : mHref(aHref)
35 , mProtocol(aProtocol)
36 , mHost(aHost)
37 , mHostname(aHostname)
38 , mPort(aPort)
39 , mPathname(aPathname)
40 , mSearch(aSearch)
41 , mHash(aHash)
43 MOZ_COUNT_CTOR(WorkerLocation);
44 SetIsDOMBinding();
47 public:
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);
55 virtual JSObject*
56 WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
58 nsISupports* GetParentObject() const {
59 return nullptr;
62 ~WorkerLocation()
64 MOZ_COUNT_DTOR(WorkerLocation);
67 void Stringify(nsString& aHref) const
69 aHref = mHref;
71 void GetHref(nsString& aHref) const
73 aHref = mHref;
75 void GetProtocol(nsString& aProtocol) const
77 aProtocol = mProtocol;
79 void GetHost(nsString& aHost) const
81 aHost = mHost;
83 void GetHostname(nsString& aHostname) const
85 aHostname = mHostname;
87 void GetPort(nsString& aPort) const
89 aPort = mPort;
91 void GetPathname(nsString& aPathname) const
93 aPathname = mPathname;
95 void GetSearch(nsString& aSearch) const
97 aSearch = mSearch;
99 void GetHash(nsString& aHash) const
101 aHash = mHash;
105 END_WORKERS_NAMESPACE
107 #endif // mozilla_dom_workers_location_h__