mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 744700 - B2G 3G: Notify connection errors in the WebMobileConnection API, r=bent
This commit is contained in:
parent
e58410adc6
commit
73f1adeeac
@ -505,6 +505,7 @@ using mozilla::dom::indexedDB::IDBWrapperCache;
|
||||
#include "nsIDOMMobileConnection.h"
|
||||
#endif
|
||||
#include "USSDReceivedEvent.h"
|
||||
#include "DataErrorEvent.h"
|
||||
#include "mozilla/dom/network/Utils.h"
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
@ -1504,6 +1505,9 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||
NS_DEFINE_CLASSINFO_DATA(USSDReceivedEvent, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(DataErrorEvent, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(CSSFontFaceRule, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(CSSFontFaceStyleDecl, nsCSSStyleDeclSH,
|
||||
@ -4156,6 +4160,11 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEvent)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(DataErrorEvent, nsIDOMDataErrorEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDataErrorEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEvent)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(CSSFontFaceRule, nsIDOMCSSFontFaceRule)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSFontFaceRule)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
@ -414,6 +414,8 @@ DOMCI_CLASS(MozMobileConnection)
|
||||
|
||||
DOMCI_CLASS(USSDReceivedEvent)
|
||||
|
||||
DOMCI_CLASS(DataErrorEvent)
|
||||
|
||||
// @font-face in CSS
|
||||
DOMCI_CLASS(CSSFontFaceRule)
|
||||
DOMCI_CLASS(CSSFontFaceStyleDecl)
|
||||
|
@ -18,6 +18,7 @@ XPIDLSRCS = \
|
||||
nsIDOMConnection.idl \
|
||||
nsIDOMUSSDReceivedEvent.idl \
|
||||
nsIDOMTCPSocket.idl \
|
||||
nsIDOMDataErrorEvent.idl \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_B2G_RIL
|
||||
|
11
dom/network/interfaces/nsIDOMDataErrorEvent.idl
Normal file
11
dom/network/interfaces/nsIDOMDataErrorEvent.idl
Normal file
@ -0,0 +1,11 @@
|
||||
/* 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 "nsIDOMEvent.idl"
|
||||
|
||||
[scriptable, builtinclass, uuid(1cfc45ba-c5d4-11e1-b4c3-00265511db39)]
|
||||
interface nsIDOMDataErrorEvent : nsIDOMEvent
|
||||
{
|
||||
readonly attribute DOMString message;
|
||||
};
|
43
dom/network/src/DataErrorEvent.cpp
Normal file
43
dom/network/src/DataErrorEvent.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
/* 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 "DataErrorEvent.h"
|
||||
#include "nsIDOMClassInfo.h"
|
||||
|
||||
DOMCI_DATA(DataErrorEvent, mozilla::dom::network::DataErrorEvent)
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
namespace network {
|
||||
|
||||
already_AddRefed<DataErrorEvent>
|
||||
DataErrorEvent::Create(nsAString& aMessage)
|
||||
{
|
||||
NS_ASSERTION(!aMessage.IsEmpty(), "Empty message!");
|
||||
|
||||
nsRefPtr<DataErrorEvent> event = new DataErrorEvent();
|
||||
|
||||
event->mMessage = aMessage;
|
||||
|
||||
return event.forget();
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(DataErrorEvent, nsDOMEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(DataErrorEvent, nsDOMEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(DataErrorEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMDataErrorEvent)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(DataErrorEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
DataErrorEvent::GetMessage(nsAString& aMessage)
|
||||
{
|
||||
aMessage.Assign(mMessage);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
63
dom/network/src/DataErrorEvent.h
Normal file
63
dom/network/src/DataErrorEvent.h
Normal file
@ -0,0 +1,63 @@
|
||||
/* 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_network_dataerrorevent_h
|
||||
#define mozilla_dom_network_dataerrorevent_h
|
||||
|
||||
#include "nsIDOMDataErrorEvent.h"
|
||||
#include "nsDOMEvent.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
namespace network {
|
||||
|
||||
class DataErrorEvent : public nsDOMEvent,
|
||||
public nsIDOMDataErrorEvent
|
||||
{
|
||||
nsString mMessage;
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_FORWARD_TO_NSDOMEVENT
|
||||
NS_DECL_NSIDOMDATAERROREVENT
|
||||
|
||||
static already_AddRefed<DataErrorEvent>
|
||||
Create(nsAString& aMessage);
|
||||
|
||||
nsresult
|
||||
Dispatch(nsIDOMEventTarget* aTarget, const nsAString& aEventType)
|
||||
{
|
||||
NS_ASSERTION(aTarget, "Null pointer!");
|
||||
NS_ASSERTION(!aEventType.IsEmpty(), "Empty event type!");
|
||||
|
||||
nsresult rv = InitEvent(aEventType, false, false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = SetTrusted(true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsIDOMEvent* thisEvent =
|
||||
static_cast<nsDOMEvent*>(const_cast<DataErrorEvent*>(this));
|
||||
|
||||
bool dummy;
|
||||
rv = aTarget->DispatchEvent(thisEvent, &dummy);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
DataErrorEvent()
|
||||
: nsDOMEvent(nullptr, nullptr)
|
||||
{ }
|
||||
|
||||
~DataErrorEvent()
|
||||
{ }
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // mozilla_dom_network_dataerrorevent_h
|
@ -32,6 +32,7 @@ CPPSRCS = \
|
||||
Connection.cpp \
|
||||
Utils.cpp \
|
||||
USSDReceivedEvent.cpp \
|
||||
DataErrorEvent.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_B2G_RIL
|
||||
|
Loading…
Reference in New Issue
Block a user