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/. */
8 #include "mozilla/dom/WorkerNavigatorBinding.h"
10 #include "RuntimeService.h"
12 BEGIN_WORKERS_NAMESPACE
14 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(WorkerNavigator
)
16 NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(WorkerNavigator
, AddRef
)
17 NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(WorkerNavigator
, Release
)
19 /* static */ already_AddRefed
<WorkerNavigator
>
20 WorkerNavigator::Create()
22 RuntimeService
* rts
= RuntimeService::GetService();
25 const RuntimeService::NavigatorStrings
& strings
=
26 rts
->GetNavigatorStrings();
28 nsRefPtr
<WorkerNavigator
> navigator
=
29 new WorkerNavigator(strings
.mAppName
, strings
.mAppVersion
,
30 strings
.mPlatform
, strings
.mUserAgent
);
32 return navigator
.forget();
36 WorkerNavigator::WrapObject(JSContext
* aCx
, JS::Handle
<JSObject
*> aScope
)
38 return WorkerNavigatorBinding_workers::Wrap(aCx
, aScope
, this);