mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-27 02:43:07 +00:00
Bug 929701 - Part 2: Implement DOMMMIError by C++. r=smaug
This commit is contained in:
parent
3f6e961c19
commit
13db67d14b
55
dom/mobileconnection/src/DOMMMIError.cpp
Normal file
55
dom/mobileconnection/src/DOMMMIError.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=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 "DOMMMIError.h"
|
||||
#include "mozilla/dom/DOMMMIErrorBinding.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(DOMMMIError)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(DOMMMIError, DOMError)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(DOMMMIError, DOMError)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(DOMMMIError)
|
||||
NS_INTERFACE_MAP_END_INHERITING(DOMError)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(DOMMMIError, DOMError)
|
||||
NS_IMPL_RELEASE_INHERITED(DOMMMIError, DOMError)
|
||||
|
||||
DOMMMIError::DOMMMIError(nsPIDOMWindow* aWindow, const nsAString& aName,
|
||||
const nsAString& aMessage, const nsAString& aServiceCode,
|
||||
const Nullable<int16_t>& aInfo)
|
||||
: DOMError(aWindow, aName, aMessage)
|
||||
, mServiceCode(aServiceCode)
|
||||
, mInfo(aInfo)
|
||||
{
|
||||
}
|
||||
|
||||
JSObject*
|
||||
DOMMMIError::WrapObject(JSContext* aCx)
|
||||
{
|
||||
return DOMMMIErrorBinding::Wrap(aCx, this);
|
||||
}
|
||||
|
||||
// WebIDL interface
|
||||
|
||||
/* static */ already_AddRefed<DOMMMIError>
|
||||
DOMMMIError::Constructor(const GlobalObject& aGlobal,
|
||||
const nsAString& aServiceCode,
|
||||
const nsAString& aName,
|
||||
const nsAString& aMessage,
|
||||
const Nullable<int16_t>& aInfo,
|
||||
ErrorResult& aRv) {
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.GetAsSupports());
|
||||
nsRefPtr<DOMMMIError> error = new DOMMMIError(window, aName, aMessage,
|
||||
aServiceCode, aInfo);
|
||||
|
||||
return error.forget();
|
||||
}
|
54
dom/mobileconnection/src/DOMMMIError.h
Normal file
54
dom/mobileconnection/src/DOMMMIError.h
Normal file
@ -0,0 +1,54 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=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_MmiError_h
|
||||
#define mozilla_dom_MmiError_h
|
||||
|
||||
#include "mozilla/dom/DOMError.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class DOMMMIError MOZ_FINAL : public DOMError
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DOMMMIError, DOMError)
|
||||
|
||||
DOMMMIError(nsPIDOMWindow* aWindow, const nsAString& aName,
|
||||
const nsAString& aMessage, const nsAString& aServiceCode,
|
||||
const Nullable<int16_t>& aInfo);
|
||||
|
||||
virtual JSObject*
|
||||
WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
||||
|
||||
// WebIDL interface
|
||||
static already_AddRefed<DOMMMIError>
|
||||
Constructor(const GlobalObject& aGlobal, const nsAString& aServiceCode,
|
||||
const nsAString& aName, const nsAString& aMessage,
|
||||
const Nullable<int16_t>& aInfo, ErrorResult& aRv);
|
||||
|
||||
void
|
||||
GetServiceCode(nsString& aServiceCode) const
|
||||
{
|
||||
aServiceCode = mServiceCode;
|
||||
}
|
||||
|
||||
Nullable<int16_t>
|
||||
GetAdditionalInformation() const
|
||||
{
|
||||
return mInfo;
|
||||
}
|
||||
|
||||
private:
|
||||
nsString mServiceCode;
|
||||
Nullable<int16_t> mInfo;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_MmiError_h
|
@ -5,11 +5,13 @@
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
EXPORTS.mozilla.dom += [
|
||||
'DOMMMIError.h',
|
||||
'MobileConnection.h',
|
||||
'MobileConnectionArray.h',
|
||||
]
|
||||
|
||||
SOURCES += [
|
||||
'DOMMMIError.cpp',
|
||||
'MobileConnection.cpp',
|
||||
'MobileConnectionArray.cpp',
|
||||
]
|
||||
|
@ -304,7 +304,7 @@ var interfaceNamesInGlobalScope =
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"DOMImplementation",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"DOMMMIError",
|
||||
{name: "DOMMMIError", b2g: true, pref: "dom.mobileconnection.enabled"},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"DOMParser",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
|
Loading…
Reference in New Issue
Block a user