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"
9 #include "RuntimeService.h"
12 #include "mozilla/dom/DebuggerNotificationObserverBinding.h"
13 #include "mozilla/dom/RegisterWorkerBindings.h"
14 #include "mozilla/dom/RegisterWorkerDebuggerBindings.h"
15 #include "mozilla/OSFileConstants.h"
17 using namespace mozilla::dom
;
19 bool WorkerPrivate::RegisterBindings(JSContext
* aCx
,
20 JS::Handle
<JSObject
*> aGlobal
) {
21 // Init Web IDL bindings
22 if (!RegisterWorkerBindings(aCx
, aGlobal
)) {
26 if (IsChromeWorker()) {
27 if (!DefineChromeWorkerFunctions(aCx
, aGlobal
)) {
31 RefPtr
<OSFileConstantsService
> service
=
32 OSFileConstantsService::GetOrCreate();
33 if (!service
->DefineOSFileConstants(aCx
, aGlobal
)) {
41 bool WorkerPrivate::RegisterDebuggerBindings(JSContext
* aCx
,
42 JS::Handle
<JSObject
*> aGlobal
) {
43 // Init Web IDL bindings
44 if (!RegisterWorkerDebuggerBindings(aCx
, aGlobal
)) {
48 if (!ChromeUtils_Binding::GetConstructorObject(aCx
)) {
52 if (!DebuggerNotificationObserver_Binding::GetConstructorObject(aCx
)) {
56 if (!JS_DefineDebuggerObject(aCx
, aGlobal
)) {