2012-09-11 10:05:00 +04:00
|
|
|
/* 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
|
|
|
|
|
2012-09-18 22:01:03 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2013-06-12 11:00:07 +04:00
|
|
|
#include "nsISupports.h"
|
|
|
|
#include "nsPIDOMWindow.h"
|
|
|
|
#include "nsWrapperCache.h"
|
2012-09-11 10:05:00 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2013-06-12 11:00:07 +04:00
|
|
|
|
|
|
|
class Date;
|
|
|
|
|
2012-09-11 10:05:00 +04:00
|
|
|
namespace time {
|
2012-09-28 10:02:28 +04:00
|
|
|
|
2013-06-12 11:00:07 +04:00
|
|
|
class TimeManager MOZ_FINAL : public nsISupports
|
|
|
|
, public nsWrapperCache
|
2012-09-11 10:05:00 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-02-06 22:28:14 +04:00
|
|
|
static bool PrefEnabled(JSContext* aCx, JSObject* aGlobal)
|
2013-06-12 11:00:07 +04:00
|
|
|
{
|
|
|
|
#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(nsPIDOMWindow* aWindow)
|
|
|
|
: mWindow(aWindow)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
nsPIDOMWindow* GetParentObject() const
|
|
|
|
{
|
|
|
|
return mWindow;
|
|
|
|
}
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 17:13:33 +03:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) MOZ_OVERRIDE;
|
2013-06-12 11:00:07 +04:00
|
|
|
|
|
|
|
void Set(Date& aDate);
|
|
|
|
void Set(double aTime);
|
|
|
|
|
|
|
|
private:
|
2014-06-23 23:56:07 +04:00
|
|
|
~TimeManager() {}
|
|
|
|
|
2013-06-12 11:00:07 +04:00
|
|
|
nsCOMPtr<nsPIDOMWindow> mWindow;
|
2012-09-11 10:05:00 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace time
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif //mozilla_dom_time_TimeManager_h
|