Bug 1688354 [wpt PR 27298] - Treat 'rem' as an absolute unit for font size, a=testonly
[gecko.git] / dom / workers / RegisterBindings.cpp
blobefede2ba4929e309f831ef2b597803e1ddadb799
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"
10 #include "jsapi.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)) {
22 return false;
25 if (IsChromeWorker()) {
26 if (!DefineChromeWorkerFunctions(aCx, aGlobal)) {
27 return false;
30 RefPtr<OSFileConstantsService> service =
31 OSFileConstantsService::GetOrCreate();
32 if (!service->DefineOSFileConstants(aCx, aGlobal)) {
33 return false;
37 return true;
40 bool WorkerPrivate::RegisterDebuggerBindings(JSContext* aCx,
41 JS::Handle<JSObject*> aGlobal) {
42 // Init Web IDL bindings
43 if (!RegisterWorkerDebuggerBindings(aCx, aGlobal)) {
44 return false;
47 if (!ChromeUtils_Binding::GetConstructorObject(aCx)) {
48 return false;
51 if (!DebuggerNotificationObserver_Binding::GetConstructorObject(aCx)) {
52 return false;
55 if (!JS_DefineDebuggerObject(aCx, aGlobal)) {
56 return false;
59 return true;