Backed out 2 changesets (bug 1432271) for bustage in /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/dom/Navigator.h:79:23 on a CLOSED TREE

Backed out changeset 7af7827525c8 (bug 1432271)
Backed out changeset 79b9d49e08db (bug 1432271)
This commit is contained in:
Noemi Erli 2018-01-27 02:49:25 +02:00
Родитель 0fef68ce31
Коммит 97a87e010b
27 изменённых файлов: 618 добавлений и 3 удалений

Просмотреть файл

@ -62,6 +62,7 @@
#include "nsIStringStream.h"
#include "nsIHttpChannel.h"
#include "nsIHttpChannelInternal.h"
#include "TimeManager.h"
#include "nsStreamUtils.h"
#include "WidgetUtils.h"
#include "nsIPresentationService.h"
@ -197,6 +198,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Navigator)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mStorageManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCredentials)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMediaDevices)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTimeManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mServiceWorkerContainer)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow)
@ -246,6 +248,10 @@ Navigator::Invalidate()
mMediaDevices = nullptr;
if (mTimeManager) {
mTimeManager = nullptr;
}
if (mPresentation) {
mPresentation = nullptr;
}
@ -1496,6 +1502,23 @@ Navigator::GetConnection(ErrorResult& aRv)
return mConnection;
}
#ifdef MOZ_TIME_MANAGER
time::TimeManager*
Navigator::GetMozTime(ErrorResult& aRv)
{
if (!mWindow) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return nullptr;
}
if (!mTimeManager) {
mTimeManager = new time::TimeManager(mWindow);
}
return mTimeManager;
}
#endif
already_AddRefed<ServiceWorkerContainer>
Navigator::ServiceWorker()
{

Просмотреть файл

@ -75,8 +75,11 @@ class VRDisplay;
class VRServiceTest;
class StorageManager;
class Navigator final : public nsIDOMNavigator
, public nsIMozNavigatorNetwork
namespace time {
class TimeManager;
} // namespace time
class Navigator final : public nsISupports
, public nsWrapperCache
{
public:
@ -179,6 +182,9 @@ public:
bool IsWebVRContentPresenting() const;
void RequestVRPresentation(VRDisplay& aDisplay);
nsINetworkProperties* GetNetworkProperties();
#ifdef MOZ_TIME_MANAGER
time::TimeManager* GetMozTime(ErrorResult& aRv);
#endif // MOZ_TIME_MANAGER
Presentation* GetPresentation(ErrorResult& aRv);
@ -265,6 +271,7 @@ private:
RefPtr<network::Connection> mConnection;
RefPtr<CredentialsContainer> mCredentials;
RefPtr<MediaDevices> mMediaDevices;
RefPtr<time::TimeManager> mTimeManager;
RefPtr<ServiceWorkerContainer> mServiceWorkerContainer;
nsCOMPtr<nsPIDOMWindowInner> mWindow;
RefPtr<Presentation> mPresentation;

Просмотреть файл

@ -426,6 +426,7 @@ LOCAL_INCLUDES += [
'../events',
'../media',
'../network',
'../time',
'/caps',
'/docshell/base',
'/dom/base',

Просмотреть файл

@ -228,6 +228,7 @@
#include "mozilla/DOMEventTargetHelper.h"
#include "prrng.h"
#include "nsSandboxFlags.h"
#include "TimeChangeObserver.h"
#include "mozilla/dom/AudioContext.h"
#include "mozilla/dom/BrowserElementDictionariesBinding.h"
#include "mozilla/dom/cache/CacheStorage.h"
@ -6871,6 +6872,18 @@ nsGlobalWindowInner::IsVRContentPresenting() const
return false;
}
void
nsGlobalWindowInner::EnableTimeChangeNotifications()
{
mozilla::time::AddWindowListener(this);
}
void
nsGlobalWindowInner::DisableTimeChangeNotifications()
{
mozilla::time::RemoveWindowListener(this);
}
void
nsGlobalWindowInner::AddSizeOfIncludingThis(nsWindowSizes& aWindowSizes) const
{

Просмотреть файл

@ -489,6 +489,9 @@ public:
virtual void DisableOrientationChangeListener() override;
#endif
virtual void EnableTimeChangeNotifications() override;
virtual void DisableTimeChangeNotifications() override;
bool IsClosedOrClosing() {
return mCleanedUp;
}

Просмотреть файл

@ -226,6 +226,7 @@
#include "mozilla/DOMEventTargetHelper.h"
#include "prrng.h"
#include "nsSandboxFlags.h"
#include "TimeChangeObserver.h"
#include "mozilla/dom/AudioContext.h"
#include "mozilla/dom/BrowserElementDictionariesBinding.h"
#include "mozilla/dom/cache/CacheStorage.h"

Просмотреть файл

@ -558,6 +558,9 @@ public:
virtual void DisableOrientationChangeListener() = 0;
#endif
virtual void EnableTimeChangeNotifications() = 0;
virtual void DisableTimeChangeNotifications() = 0;
/**
* Tell this window that there is an observer for gamepad input
*

Просмотреть файл

@ -601,6 +601,10 @@ DOMInterfaces = {
'notflattened': True
},
'MozTimeManager': {
'nativeType': 'mozilla::dom::time::TimeManager',
},
'MozStorageAsyncStatementParams': {
'headerFile': 'mozilla/storage/mozStorageAsyncStatementParams.h',
'nativeType': 'mozilla::storage::AsyncStatementParams',

Просмотреть файл

@ -211,6 +211,7 @@
#include "nsIPrincipal.h"
#include "DomainPolicy.h"
#include "mozilla/dom/ipc/StructuredCloneData.h"
#include "mozilla/dom/time/DateCacheCleaner.h"
#include "mozilla/ipc/CrashReporterClient.h"
#include "mozilla/net/NeckoMessageUtils.h"
#include "mozilla/widget/PuppetBidiKeyboard.h"
@ -1221,6 +1222,9 @@ ContentChild::InitXPCOM(const XPCOMInitData& aXPCOMInit,
nsCOMPtr<nsIURI> ucsURL = DeserializeURI(aXPCOMInit.userContentSheetURL());
nsLayoutStylesheetCache::SetUserContentCSSURL(ucsURL);
// This will register cross-process observer.
mozilla::dom::time::InitializeDateCacheCleaner();
GfxInfoBase::SetFeatureStatus(aXPCOMInit.gfxFeatureStatus());
DataStorage::SetCachedStorageEntries(aXPCOMInit.dataStorage());

Просмотреть файл

@ -57,6 +57,7 @@
#include "mozilla/dom/PPresentationParent.h"
#include "mozilla/dom/PushNotifier.h"
#include "mozilla/dom/quota/QuotaManagerService.h"
#include "mozilla/dom/time/DateCacheCleaner.h"
#include "mozilla/dom/URLClassifierParent.h"
#include "mozilla/embedding/printingui/PrintingParent.h"
#include "mozilla/extensions/StreamFilterParent.h"
@ -627,6 +628,8 @@ ContentParent::StartUp()
// Note: This reporter measures all ContentParents.
RegisterStrongMemoryReporter(new ContentParentsMemoryReporter());
mozilla::dom::time::InitializeDateCacheCleaner();
BackgroundChild::Startup();
ClientManager::Startup();

Просмотреть файл

@ -74,6 +74,7 @@ DIRS += [
'security',
'storage',
'svg',
'time',
'locales',
'network',
'permission',

Просмотреть файл

@ -0,0 +1,54 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 "DateCacheCleaner.h"
#include "js/Date.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/Hal.h"
#include "mozilla/StaticPtr.h"
using namespace mozilla::hal;
namespace mozilla {
namespace dom {
namespace time {
class DateCacheCleaner : public SystemTimezoneChangeObserver
{
public:
DateCacheCleaner()
{
RegisterSystemTimezoneChangeObserver(this);
}
~DateCacheCleaner()
{
UnregisterSystemTimezoneChangeObserver(this);
}
void Notify(const SystemTimezoneChangeInformation& aSystemTimezoneChangeInfo) override
{
JS::ResetTimeZone();
}
};
StaticAutoPtr<DateCacheCleaner> sDateCacheCleaner;
void
InitializeDateCacheCleaner()
{
if (!sDateCacheCleaner) {
sDateCacheCleaner = new DateCacheCleaner();
ClearOnShutdown(&sDateCacheCleaner);
}
}
} // namespace time
} // namespace dom
} // namespace mozilla

Просмотреть файл

@ -0,0 +1,19 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
/*
* InitializeDateCacheCleaner registers DateCacheCleaner to
* SystemTimeChangeObserver. When time zone is changed, DateCacheCleaner calls
* JS::ResetTimeZone to update the time zone information.
*/
namespace mozilla {
namespace dom {
namespace time {
void InitializeDateCacheCleaner();
} //namespace time
} //namespace dom
} //namespace mozilla

Просмотреть файл

@ -0,0 +1,166 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 "TimeChangeObserver.h"
#include "mozilla/Hal.h"
#include "mozilla/Observer.h"
#include "mozilla/HalTypes.h"
#include "nsWeakPtr.h"
#include "nsTObserverArray.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/Services.h"
#include "mozilla/StaticPtr.h"
#include "nsPIDOMWindow.h"
#include "nsContentUtils.h"
#include "nsIObserverService.h"
#include "nsIDocument.h"
using namespace mozilla;
using namespace mozilla::hal;
using namespace mozilla::services;
class nsSystemTimeChangeObserver : public SystemClockChangeObserver,
public SystemTimezoneChangeObserver
{
typedef nsTObserverArray<nsWeakPtr> ListenerArray;
public:
static nsSystemTimeChangeObserver* GetInstance();
virtual ~nsSystemTimeChangeObserver();
// Implementing hal::SystemClockChangeObserver::Notify()
void Notify(const int64_t& aClockDeltaMS) override;
// Implementing hal::SystemTimezoneChangeObserver::Notify()
void Notify(
const mozilla::hal::SystemTimezoneChangeInformation& aSystemTimezoneChangeInfo) override;
nsresult AddWindowListenerImpl(nsPIDOMWindowInner* aWindow);
nsresult RemoveWindowListenerImpl(nsPIDOMWindowInner* aWindow);
private:
nsSystemTimeChangeObserver() { };
ListenerArray mWindowListeners;
void FireMozTimeChangeEvent();
};
StaticAutoPtr<nsSystemTimeChangeObserver> sObserver;
nsSystemTimeChangeObserver* nsSystemTimeChangeObserver::GetInstance()
{
if (!sObserver) {
sObserver = new nsSystemTimeChangeObserver();
ClearOnShutdown(&sObserver);
}
return sObserver;
}
nsSystemTimeChangeObserver::~nsSystemTimeChangeObserver()
{
UnregisterSystemClockChangeObserver(this);
UnregisterSystemTimezoneChangeObserver(this);
}
void
nsSystemTimeChangeObserver::FireMozTimeChangeEvent()
{
ListenerArray::ForwardIterator iter(mWindowListeners);
while (iter.HasMore()) {
nsWeakPtr weakWindow = iter.GetNext();
nsCOMPtr<nsPIDOMWindowInner> innerWindow = do_QueryReferent(weakWindow);
nsCOMPtr<nsPIDOMWindowOuter> outerWindow;
nsCOMPtr<nsIDocument> document;
if (!innerWindow ||
!(document = innerWindow->GetExtantDoc()) ||
!(outerWindow = innerWindow->GetOuterWindow())) {
mWindowListeners.RemoveElement(weakWindow);
continue;
}
nsContentUtils::DispatchTrustedEvent(document, outerWindow,
NS_LITERAL_STRING("moztimechange"), /* bubbles = */ true,
/* canceable = */ false);
}
}
void
nsSystemTimeChangeObserver::Notify(const int64_t& aClockDeltaMS)
{
// Notify observers that the system clock has been adjusted.
nsCOMPtr<nsIObserverService> observerService = GetObserverService();
if (observerService) {
nsString dataStr;
dataStr.AppendFloat(static_cast<double>(aClockDeltaMS));
observerService->NotifyObservers(
nullptr, "system-clock-change", dataStr.get());
}
FireMozTimeChangeEvent();
}
void
nsSystemTimeChangeObserver::Notify(
const SystemTimezoneChangeInformation& aSystemTimezoneChangeInfo)
{
FireMozTimeChangeEvent();
}
nsresult
mozilla::time::AddWindowListener(nsPIDOMWindowInner* aWindow)
{
return nsSystemTimeChangeObserver::GetInstance()->AddWindowListenerImpl(aWindow);
}
nsresult
nsSystemTimeChangeObserver::AddWindowListenerImpl(nsPIDOMWindowInner* aWindow)
{
if (!aWindow) {
return NS_ERROR_ILLEGAL_VALUE;
}
nsWeakPtr windowWeakRef = do_GetWeakReference(aWindow);
NS_ASSERTION(windowWeakRef, "nsIDOMWindow implementations shuld support weak ref");
if (mWindowListeners.IndexOf(windowWeakRef) !=
ListenerArray::array_type::NoIndex) {
return NS_OK;
}
if (mWindowListeners.IsEmpty()) {
RegisterSystemClockChangeObserver(sObserver);
RegisterSystemTimezoneChangeObserver(sObserver);
}
mWindowListeners.AppendElement(windowWeakRef);
return NS_OK;
}
nsresult
mozilla::time::RemoveWindowListener(nsPIDOMWindowInner* aWindow)
{
if (!sObserver) {
return NS_OK;
}
return nsSystemTimeChangeObserver::GetInstance()->RemoveWindowListenerImpl(aWindow);
}
nsresult
nsSystemTimeChangeObserver::RemoveWindowListenerImpl(nsPIDOMWindowInner* aWindow)
{
if (!aWindow) {
return NS_OK;
}
nsWeakPtr windowWeakRef = do_GetWeakReference(aWindow);
mWindowListeners.RemoveElement(windowWeakRef);
if (mWindowListeners.IsEmpty()) {
UnregisterSystemClockChangeObserver(sObserver);
UnregisterSystemTimezoneChangeObserver(sObserver);
}
return NS_OK;
}

Просмотреть файл

@ -0,0 +1,23 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
#ifndef _mozilla_time_change_observer_h_
#define _mozilla_time_change_observer_h_
#include "nscore.h"
class nsPIDOMWindowInner;
namespace mozilla {
namespace time {
nsresult AddWindowListener(nsPIDOMWindowInner* aWindow);
nsresult RemoveWindowListener(nsPIDOMWindowInner* aWindow);
} // namespace time
} // namespace mozilla
#endif //_mozilla_time_change_observer_h_

51
dom/time/TimeManager.cpp Normal file
Просмотреть файл

@ -0,0 +1,51 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 "TimeManager.h"
#include "mozilla/dom/Date.h"
#include "mozilla/dom/MozTimeManagerBinding.h"
#include "nsITimeService.h"
#include "nsServiceManagerUtils.h"
namespace mozilla {
namespace dom {
namespace time {
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TimeManager)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(TimeManager)
NS_IMPL_CYCLE_COLLECTING_RELEASE(TimeManager)
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(TimeManager, mWindow)
JSObject*
TimeManager::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
return MozTimeManagerBinding::Wrap(aCx, this, aGivenProto);
}
void
TimeManager::Set(Date& aDate)
{
Set(aDate.ToDouble());
}
void
TimeManager::Set(double aTime)
{
nsCOMPtr<nsITimeService> timeService = do_GetService(TIMESERVICE_CONTRACTID);
if (timeService) {
timeService->Set(aTime);
}
}
} // namespace time
} // namespace dom
} // namespace mozilla

62
dom/time/TimeManager.h Normal file
Просмотреть файл

@ -0,0 +1,62 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
#ifndef mozilla_dom_time_TimeManager_h
#define mozilla_dom_time_TimeManager_h
#include "mozilla/Attributes.h"
#include "nsISupports.h"
#include "nsPIDOMWindow.h"
#include "nsWrapperCache.h"
namespace mozilla {
namespace dom {
class Date;
namespace time {
class TimeManager final : public nsISupports
, public nsWrapperCache
{
public:
static bool PrefEnabled(JSContext* aCx, JSObject* aGlobal)
{
#ifdef MOZ_TIME_MANAGER
return true;
#else
return false;
#endif
}
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TimeManager)
explicit TimeManager(nsPIDOMWindowInner* aWindow)
: mWindow(aWindow)
{
}
nsPIDOMWindowInner* GetParentObject() const
{
return mWindow;
}
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
void Set(Date& aDate);
void Set(double aTime);
private:
~TimeManager() {}
nsCOMPtr<nsPIDOMWindowInner> mWindow;
};
} // namespace time
} // namespace dom
} // namespace mozilla
#endif //mozilla_dom_time_TimeManager_h

40
dom/time/TimeService.cpp Normal file
Просмотреть файл

@ -0,0 +1,40 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 "base/basictypes.h"
#include "jsapi.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/Hal.h"
#include "TimeService.h"
namespace mozilla {
namespace dom {
namespace time {
NS_IMPL_ISUPPORTS(TimeService, nsITimeService)
/* static */ StaticRefPtr<TimeService> TimeService::sSingleton;
/* static */ already_AddRefed<TimeService>
TimeService::GetInstance()
{
if (!sSingleton) {
sSingleton = new TimeService();
ClearOnShutdown(&sSingleton);
}
RefPtr<TimeService> service = sSingleton.get();
return service.forget();
}
NS_IMETHODIMP
TimeService::Set(int64_t aTimeInMS) {
hal::AdjustSystemClock(aTimeInMS - (JS_Now() / PR_USEC_PER_MSEC));
return NS_OK;
}
} // namespace time
} // namespace dom
} // namespace mozilla

38
dom/time/TimeService.h Normal file
Просмотреть файл

@ -0,0 +1,38 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
#ifndef mozilla_dom_time_TimeService_h
#define mozilla_dom_time_TimeService_h
#include "mozilla/StaticPtr.h"
#include "nsITimeService.h"
namespace mozilla {
namespace dom {
namespace time {
/**
* This class implements a service which lets us modify the system clock time.
*/
class TimeService : public nsITimeService
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSITIMESERVICE
static already_AddRefed<TimeService> GetInstance();
private:
virtual ~TimeService() {};
static StaticRefPtr<TimeService> sSingleton;
};
} // namespace time
} // namespace dom
} // namespace mozilla
#endif //mozilla_dom_time_TimeService_h

32
dom/time/moz.build Normal file
Просмотреть файл

@ -0,0 +1,32 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
with Files("**"):
BUG_COMPONENT = ("Core", "DOM: Device Interfaces")
XPIDL_SOURCES += [
'nsITimeService.idl',
]
XPIDL_MODULE = 'dom_time'
EXPORTS.mozilla.dom.time += [
'DateCacheCleaner.h',
'TimeChangeObserver.h',
'TimeManager.h',
'TimeService.h',
]
UNIFIED_SOURCES += [
'DateCacheCleaner.cpp',
'TimeChangeObserver.cpp',
'TimeManager.cpp',
'TimeService.cpp',
]
include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'

Просмотреть файл

@ -0,0 +1,20 @@
/* 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 "nsISupports.idl"
%{C++
#define NS_TIMESERVICE_CID { 0x80d6f9cc, 0xf16d, 0x40c3, { 0xa5, 0x2e, 0xc4, 0xe6, 0x56, 0xe3, 0x65, 0xb4 } }
#define TIMESERVICE_CONTRACTID "@mozilla.org/time/timeservice;1"
%}
[scriptable, builtinclass, uuid(1fc7fde2-0090-11e2-bdd6-0fea4b9f41f8)]
interface nsITimeService : nsISupports
{
/* Set the system time.
*
* The |aTimeInMS| argument is the time in milliseconds since the epoch.
*/
void set(in int64_t aTimeInMS);
};

Просмотреть файл

@ -0,0 +1,18 @@
/* 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/. */
[Func="mozilla::dom::time::TimeManager::PrefEnabled"]
interface MozTimeManager {
/* Set the system time.
*
* The |time| argument can be either a Date object or a number.
*
* - If |time| is a number, it's interpreted as milliseconds
* since the epoch (midnight UTC on January 1, 1970).
* - If |time| is a Date object, |set(time)| is equivalent to
* |set(time.getTime())|.
*/
void set(Date time);
void set(double time);
};

Просмотреть файл

@ -234,6 +234,14 @@ partial interface Navigator {
VRServiceTest requestVRServiceTest();
};
#ifdef MOZ_TIME_MANAGER
// nsIDOMMozNavigatorTime
partial interface Navigator {
[Throws, ChromeOnly]
readonly attribute MozTimeManager mozTime;
};
#endif // MOZ_TIME_MANAGER
callback NavigatorUserMediaSuccessCallback = void (MediaStream stream);
callback NavigatorUserMediaErrorCallback = void (MediaStreamError error);

Просмотреть файл

@ -211,6 +211,9 @@ with Files("Media*Track*"):
with Files("Mouse*"):
BUG_COMPONENT = ("Core", "DOM: Events")
with Files("MozTimeManager.webidl"):
BUG_COMPONENT = ("Core", "DOM: Device Interfaces")
with Files("MutationEvent.webidl"):
BUG_COMPONENT = ("Core", "DOM: Events")
@ -361,6 +364,7 @@ GENERATED_WEBIDL_FILES = [
PREPROCESSED_WEBIDL_FILES = [
'ChromeUtils.webidl',
'Navigator.webidl',
'Node.webidl',
'Window.webidl',
]
@ -686,11 +690,11 @@ WEBIDL_FILES = [
'MozStorageAsyncStatementParams.webidl',
'MozStorageStatementParams.webidl',
'MozStorageStatementRow.webidl',
'MozTimeManager.webidl',
'MutationEvent.webidl',
'MutationObserver.webidl',
'NamedNodeMap.webidl',
'NativeOSFileInternals.webidl',
'Navigator.webidl',
'NetDashboard.webidl',
'NetworkInformation.webidl',
'NetworkOptions.webidl',

Просмотреть файл

@ -163,6 +163,7 @@ static void Shutdown();
#include "mozilla/net/WebSocketEventService.h"
#include "mozilla/dom/power/PowerManagerService.h"
#include "mozilla/dom/time/TimeService.h"
#include "nsIPresentationService.h"
@ -184,6 +185,7 @@ using mozilla::dom::quota::QuotaManagerService;
using mozilla::dom::workers::ServiceWorkerManager;
using mozilla::dom::workers::WorkerDebuggerManager;
using mozilla::dom::UDPSocketChild;
using mozilla::dom::time::TimeService;
using mozilla::gmp::GeckoMediaPluginService;
using mozilla::dom::NotificationTelemetryService;
@ -259,6 +261,8 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsHapticFeedback)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(ThirdPartyUtil, Init)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIPowerManagerService,
PowerManagerService::GetInstance)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsITimeService,
TimeService::GetInstance)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIMediaManagerService,
MediaManager::GetInstance)
@ -645,6 +649,7 @@ NS_DEFINE_NAMED_CID(NS_HAPTICFEEDBACK_CID);
NS_DEFINE_NAMED_CID(NS_POWERMANAGERSERVICE_CID);
NS_DEFINE_NAMED_CID(OSFILECONSTANTSSERVICE_CID);
NS_DEFINE_NAMED_CID(UDPSOCKETCHILD_CID);
NS_DEFINE_NAMED_CID(NS_TIMESERVICE_CID);
NS_DEFINE_NAMED_CID(NS_MEDIAMANAGERSERVICE_CID);
#ifdef MOZ_WEBSPEECH_TEST_BACKEND
NS_DEFINE_NAMED_CID(NS_FAKE_SPEECH_RECOGNITION_SERVICE_CID);
@ -905,6 +910,7 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
{ &kOSFILECONSTANTSSERVICE_CID, true, nullptr, OSFileConstantsServiceConstructor },
{ &kUDPSOCKETCHILD_CID, false, nullptr, UDPSocketChildConstructor },
{ &kGECKO_MEDIA_PLUGIN_SERVICE_CID, true, nullptr, GeckoMediaPluginServiceConstructor },
{ &kNS_TIMESERVICE_CID, false, nullptr, nsITimeServiceConstructor },
{ &kNS_MEDIAMANAGERSERVICE_CID, false, nullptr, nsIMediaManagerServiceConstructor },
#ifdef ACCESSIBILITY
{ &kNS_ACCESSIBILITY_SERVICE_CID, false, nullptr, CreateA11yService },
@ -1023,6 +1029,7 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = {
{ POWERMANAGERSERVICE_CONTRACTID, &kNS_POWERMANAGERSERVICE_CID, Module::ALLOW_IN_GPU_PROCESS },
{ OSFILECONSTANTSSERVICE_CONTRACTID, &kOSFILECONSTANTSSERVICE_CID },
{ "@mozilla.org/udp-socket-child;1", &kUDPSOCKETCHILD_CID },
{ TIMESERVICE_CONTRACTID, &kNS_TIMESERVICE_CID },
{ MEDIAMANAGERSERVICE_CONTRACTID, &kNS_MEDIAMANAGERSERVICE_CID },
#ifdef ACCESSIBILITY
{ "@mozilla.org/accessibilityService;1", &kNS_ACCESSIBILITY_SERVICE_CID },

Просмотреть файл

@ -106,6 +106,7 @@
#include "nsCookieService.h"
#include "nsApplicationCacheService.h"
#include "mozilla/dom/CustomElementRegistry.h"
#include "mozilla/dom/time/DateCacheCleaner.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/IMEStateManager.h"
#include "mozilla/dom/HTMLVideoElement.h"

Просмотреть файл

@ -1991,6 +1991,7 @@ NECKO_COOKIES=1
MOZ_USE_NATIVE_POPUP_WINDOWS=
MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
ACCESSIBILITY=1
MOZ_TIME_MANAGER=
MOZ_CONTENT_SANDBOX=
MOZ_GMP_SANDBOX=
MOZ_SANDBOX=1
@ -3805,6 +3806,14 @@ if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
fi
AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
dnl ========================================================
dnl = Enable Support for Time Manager API
dnl ========================================================
if test -n "$MOZ_TIME_MANAGER"; then
AC_DEFINE(MOZ_TIME_MANAGER)
fi
AC_SUBST(MOZ_TIME_MANAGER)
dnl ========================================================
dnl = Enable Support for Secure Element API
dnl ========================================================