1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "WorkerPrivate.h"
8 #include "ChromeWorkerScope.h"
11 #include "mozilla/dom/DebuggerNotificationObserverBinding.h"
12 #include "mozilla/dom/RegisterWorkerBindings.h"
13 #include "mozilla/dom/RegisterWorkerDebuggerBindings.h"
14 #include "mozilla/OSFileConstants.h"
16 using namespace mozilla::dom
;
18 bool WorkerPrivate::RegisterBindings(JSContext
* aCx
,
19 JS::Handle
<JSObject
*> aGlobal
) {
20 // Init Web IDL bindings
21 if (!RegisterWorkerBindings(aCx
, aGlobal
)) {
25 if (IsChromeWorker()) {
26 if (!DefineChromeWorkerFunctions(aCx
, aGlobal
)) {
30 RefPtr
<OSFileConstantsService
> service
=
31 OSFileConstantsService::GetOrCreate();
32 if (!service
->DefineOSFileConstants(aCx
, aGlobal
)) {
40 bool WorkerPrivate::RegisterDebuggerBindings(JSContext
* aCx
,
41 JS::Handle
<JSObject
*> aGlobal
) {
42 // Init Web IDL bindings
43 if (!RegisterWorkerDebuggerBindings(aCx
, aGlobal
)) {
47 if (!ChromeUtils_Binding::GetConstructorObject(aCx
)) {
51 if (!DebuggerNotificationObserver_Binding::GetConstructorObject(aCx
)) {
55 if (!JS_DefineDebuggerObject(aCx
, aGlobal
)) {