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_navigator_h__
7 #define mozilla_dom_workers_navigator_h__
11 #include "nsWrapperCache.h"
13 BEGIN_WORKERS_NAMESPACE
15 class WorkerNavigator MOZ_FINAL
: public nsWrapperCache
22 WorkerNavigator(const nsAString
& aAppName
,
23 const nsAString
& aAppVersion
,
24 const nsAString
& aPlatform
,
25 const nsAString
& aUserAgent
)
27 , mAppVersion(aAppVersion
)
28 , mPlatform(aPlatform
)
29 , mUserAgent(aUserAgent
)
31 MOZ_COUNT_CTOR(WorkerNavigator
);
37 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WorkerNavigator
)
38 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WorkerNavigator
)
40 static already_AddRefed
<WorkerNavigator
>
44 WrapObject(JSContext
* aCx
, JS::Handle
<JSObject
*> aScope
) MOZ_OVERRIDE
;
46 nsISupports
* GetParentObject() const {
52 MOZ_COUNT_DTOR(WorkerNavigator
);
55 void GetAppCodeName(nsString
& aAppCodeName
) const
57 aAppCodeName
.AssignLiteral("Mozilla");
59 void GetAppName(nsString
& aAppName
) const
63 void GetAppVersion(nsString
& aAppVersion
) const
65 aAppVersion
= mAppVersion
;
67 void GetPlatform(nsString
& aPlatform
) const
69 aPlatform
= mPlatform
;
71 void GetProduct(nsString
& aProduct
) const
73 aProduct
.AssignLiteral("Gecko");
75 bool TaintEnabled() const
79 void GetUserAgent(nsString
& aUserAgent
) const
81 aUserAgent
= mUserAgent
;
87 #endif // mozilla_dom_workers_navigator_h__