|
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/. */ |
|
5 |
|
6 #ifndef mozilla_dom_workers_location_h__ |
|
7 #define mozilla_dom_workers_location_h__ |
|
8 |
|
9 #include "Workers.h" |
|
10 #include "WorkerPrivate.h" |
|
11 #include "nsWrapperCache.h" |
|
12 |
|
13 BEGIN_WORKERS_NAMESPACE |
|
14 |
|
15 class WorkerLocation MOZ_FINAL : public nsWrapperCache |
|
16 { |
|
17 nsString mHref; |
|
18 nsString mProtocol; |
|
19 nsString mHost; |
|
20 nsString mHostname; |
|
21 nsString mPort; |
|
22 nsString mPathname; |
|
23 nsString mSearch; |
|
24 nsString mHash; |
|
25 nsString mOrigin; |
|
26 |
|
27 WorkerLocation(const nsAString& aHref, |
|
28 const nsAString& aProtocol, |
|
29 const nsAString& aHost, |
|
30 const nsAString& aHostname, |
|
31 const nsAString& aPort, |
|
32 const nsAString& aPathname, |
|
33 const nsAString& aSearch, |
|
34 const nsAString& aHash, |
|
35 const nsAString& aOrigin) |
|
36 : mHref(aHref) |
|
37 , mProtocol(aProtocol) |
|
38 , mHost(aHost) |
|
39 , mHostname(aHostname) |
|
40 , mPort(aPort) |
|
41 , mPathname(aPathname) |
|
42 , mSearch(aSearch) |
|
43 , mHash(aHash) |
|
44 , mOrigin(aOrigin) |
|
45 { |
|
46 MOZ_COUNT_CTOR(WorkerLocation); |
|
47 SetIsDOMBinding(); |
|
48 } |
|
49 |
|
50 public: |
|
51 |
|
52 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WorkerLocation) |
|
53 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WorkerLocation) |
|
54 |
|
55 static already_AddRefed<WorkerLocation> |
|
56 Create(WorkerPrivate::LocationInfo& aInfo); |
|
57 |
|
58 virtual JSObject* |
|
59 WrapObject(JSContext* aCx) MOZ_OVERRIDE; |
|
60 |
|
61 nsISupports* GetParentObject() const { |
|
62 return nullptr; |
|
63 } |
|
64 |
|
65 ~WorkerLocation() |
|
66 { |
|
67 MOZ_COUNT_DTOR(WorkerLocation); |
|
68 } |
|
69 |
|
70 void Stringify(nsString& aHref) const |
|
71 { |
|
72 aHref = mHref; |
|
73 } |
|
74 void GetHref(nsString& aHref) const |
|
75 { |
|
76 aHref = mHref; |
|
77 } |
|
78 void GetProtocol(nsString& aProtocol) const |
|
79 { |
|
80 aProtocol = mProtocol; |
|
81 } |
|
82 void GetHost(nsString& aHost) const |
|
83 { |
|
84 aHost = mHost; |
|
85 } |
|
86 void GetHostname(nsString& aHostname) const |
|
87 { |
|
88 aHostname = mHostname; |
|
89 } |
|
90 void GetPort(nsString& aPort) const |
|
91 { |
|
92 aPort = mPort; |
|
93 } |
|
94 void GetPathname(nsString& aPathname) const |
|
95 { |
|
96 aPathname = mPathname; |
|
97 } |
|
98 void GetSearch(nsString& aSearch) const |
|
99 { |
|
100 aSearch = mSearch; |
|
101 } |
|
102 void GetHash(nsString& aHash) const |
|
103 { |
|
104 aHash = mHash; |
|
105 } |
|
106 void GetOrigin(nsString& aOrigin) const |
|
107 { |
|
108 aOrigin = mOrigin; |
|
109 } |
|
110 }; |
|
111 |
|
112 END_WORKERS_NAMESPACE |
|
113 |
|
114 #endif // mozilla_dom_workers_location_h__ |