2013-11-05 06:16:26 -08:00
|
|
|
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "WorkerPrivate.h"
|
|
|
|
#include "ChromeWorkerScope.h"
|
2014-10-07 10:16:11 -07:00
|
|
|
#include "File.h"
|
2013-11-24 11:26:07 -08:00
|
|
|
#include "RuntimeService.h"
|
2013-11-05 06:16:26 -08:00
|
|
|
|
|
|
|
#include "jsapi.h"
|
|
|
|
#include "js/OldDebugAPI.h"
|
2014-08-04 19:20:35 -07:00
|
|
|
#include "mozilla/dom/RegisterWorkerBindings.h"
|
2013-11-05 06:16:26 -08:00
|
|
|
#include "mozilla/OSFileConstants.h"
|
|
|
|
|
|
|
|
USING_WORKERS_NAMESPACE
|
|
|
|
using namespace mozilla::dom;
|
|
|
|
|
|
|
|
bool
|
|
|
|
WorkerPrivate::RegisterBindings(JSContext* aCx, JS::Handle<JSObject*> aGlobal)
|
|
|
|
{
|
2014-08-04 19:20:35 -07:00
|
|
|
// Init Web IDL bindings
|
|
|
|
if (!RegisterWorkerBindings(aCx, aGlobal)) {
|
2013-11-05 06:16:26 -08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (IsChromeWorker()) {
|
2014-08-04 19:20:35 -07:00
|
|
|
if (!DefineChromeWorkerFunctions(aCx, aGlobal) ||
|
2013-11-05 06:16:26 -08:00
|
|
|
!DefineOSFileConstants(aCx, aGlobal)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-07 10:16:11 -07:00
|
|
|
// Init other classes we care about.
|
|
|
|
if (!file::InitClasses(aCx, aGlobal)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-11-05 06:16:26 -08:00
|
|
|
if (!JS_DefineProfilingFunctions(aCx, aGlobal)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
2013-11-24 11:26:07 -08:00
|
|
|
}
|