2014-10-27 19:53:10 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
|
|
|
/* 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 "MediaStreamError.h"
|
|
|
|
#include "mozilla/dom/MediaStreamErrorBinding.h"
|
|
|
|
#include "nsContentUtils.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
2014-10-27 22:42:56 +03:00
|
|
|
|
|
|
|
BaseMediaMgrError::BaseMediaMgrError(const nsAString& aName,
|
|
|
|
const nsAString& aMessage,
|
2015-09-18 21:03:30 +03:00
|
|
|
const nsAString& aConstraint)
|
2014-10-27 22:42:56 +03:00
|
|
|
: mName(aName)
|
|
|
|
, mMessage(aMessage)
|
2015-09-18 21:03:30 +03:00
|
|
|
, mConstraint(aConstraint)
|
2014-10-27 22:42:56 +03:00
|
|
|
{
|
|
|
|
if (mMessage.IsEmpty()) {
|
|
|
|
if (mName.EqualsLiteral("NotFoundError")) {
|
|
|
|
mMessage.AssignLiteral("The object can not be found here.");
|
2016-05-09 05:29:46 +03:00
|
|
|
} else if (mName.EqualsLiteral("NotAllowedError")) {
|
|
|
|
mMessage.AssignLiteral("The request is not allowed by the user agent "
|
|
|
|
"or the platform in the current context.");
|
2015-09-22 03:57:12 +03:00
|
|
|
} else if (mName.EqualsLiteral("SecurityError")) {
|
|
|
|
mMessage.AssignLiteral("The operation is insecure.");
|
2016-06-23 21:08:52 +03:00
|
|
|
} else if (mName.EqualsLiteral("NotReadableError")) {
|
|
|
|
mMessage.AssignLiteral("The I/O read operation failed.");
|
2014-10-27 22:42:56 +03:00
|
|
|
} else if (mName.EqualsLiteral("InternalError")) {
|
|
|
|
mMessage.AssignLiteral("Internal error.");
|
2015-05-08 22:05:48 +03:00
|
|
|
} else if (mName.EqualsLiteral("NotSupportedError")) {
|
2015-09-18 21:04:41 +03:00
|
|
|
mMessage.AssignLiteral("The operation is not supported.");
|
|
|
|
} else if (mName.EqualsLiteral("OverconstrainedError")) {
|
|
|
|
mMessage.AssignLiteral("Constraints could be not satisfied.");
|
2014-10-27 22:42:56 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMPL_ISUPPORTS0(MediaMgrError)
|
|
|
|
|
2014-10-27 19:53:10 +03:00
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
MediaStreamError::MediaStreamError(
|
2016-01-30 20:05:36 +03:00
|
|
|
nsPIDOMWindowInner* aParent,
|
2014-10-27 19:53:10 +03:00
|
|
|
const nsAString& aName,
|
|
|
|
const nsAString& aMessage,
|
2015-09-18 21:03:30 +03:00
|
|
|
const nsAString& aConstraint)
|
|
|
|
: BaseMediaMgrError(aName, aMessage, aConstraint)
|
2014-10-27 22:42:56 +03:00
|
|
|
, mParent(aParent) {}
|
2014-10-27 19:53:10 +03:00
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(MediaStreamError, mParent)
|
|
|
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(MediaStreamError)
|
|
|
|
NS_IMPL_CYCLE_COLLECTING_RELEASE(MediaStreamError)
|
|
|
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(MediaStreamError)
|
|
|
|
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
2014-09-20 10:20:41 +04:00
|
|
|
NS_INTERFACE_MAP_ENTRY(MediaStreamError)
|
2014-10-27 19:53:10 +03:00
|
|
|
NS_INTERFACE_MAP_END
|
|
|
|
|
|
|
|
JSObject*
|
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
|
|
|
MediaStreamError::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
2014-10-27 19:53:10 +03:00
|
|
|
{
|
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
|
|
|
return MediaStreamErrorBinding::Wrap(aCx, this, aGivenProto);
|
2014-10-27 19:53:10 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
MediaStreamError::GetName(nsAString& aName) const
|
|
|
|
{
|
|
|
|
aName = mName;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
MediaStreamError::GetMessage(nsAString& aMessage) const
|
|
|
|
{
|
|
|
|
aMessage = mMessage;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-09-18 21:03:30 +03:00
|
|
|
MediaStreamError::GetConstraint(nsAString& aConstraint) const
|
2014-10-27 19:53:10 +03:00
|
|
|
{
|
2015-09-18 21:03:30 +03:00
|
|
|
aConstraint = mConstraint;
|
2014-10-27 19:53:10 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|