Bug 948850 - B2G NFC: to add onpeerready causes app to be killed. r=khuey

This commit is contained in:
Yoshi Huang 2014-01-13 17:33:12 +08:00
parent f56afe3f82
commit d8d069d181
3 changed files with 11 additions and 1 deletions

View File

@ -1815,8 +1815,15 @@ Navigator::HasNfcSupport(JSContext* /* unused */, JSObject* aGlobal)
return win && (CheckPermission(win, "nfc-read") ||
CheckPermission(win, "nfc-write"));
}
#endif // MOZ_NFC
/* static */
bool
Navigator::HasNfcPeerSupport(JSContext* /* unused */, JSObject* aGlobal)
{
nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
return win && CheckPermission(win, "nfc-write");
}
#endif // MOZ_NFC
#ifdef MOZ_TIME_MANAGER
/* static */

View File

@ -273,6 +273,7 @@ public:
#endif // MOZ_B2G_FM
#ifdef MOZ_NFC
static bool HasNfcSupport(JSContext* /* unused */, JSObject* aGlobal);
static bool HasNfcPeerSupport(JSContext* /* unused */, JSObject* aGlobal);
#endif // MOZ_NFC
#ifdef MOZ_TIME_MANAGER
static bool HasTimeSupport(JSContext* /* unused */, JSObject* aGlobal);

View File

@ -23,7 +23,9 @@ interface MozNfc : EventTarget {
*/
DOMRequest checkP2PRegistration(DOMString manifestUrl);
[Func="Navigator::HasNfcPeerSupport"]
attribute EventHandler onpeerready;
[Func="Navigator::HasNfcPeerSupport"]
attribute EventHandler onpeerlost;
[ChromeOnly]
void eventListenerWasAdded(DOMString aType);