Merge mozilla-central and b2g-inbound

This commit is contained in:
Ed Morley 2014-08-04 12:17:11 +01:00
Родитель efe972f974 ad34e3d539
Коммит af3100257a
39 изменённых файлов: 211 добавлений и 460 удалений

Просмотреть файл

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="af9a0a24fb9f4c5ced3602bc14053bd49b136344"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="965a7a2c6e3ab0e2dabcbbce69156dfb17403ccc"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="d61daef8fca7d6f335f659a8967bad423770e634"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>

Просмотреть файл

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="af9a0a24fb9f4c5ced3602bc14053bd49b136344"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="965a7a2c6e3ab0e2dabcbbce69156dfb17403ccc"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="d61daef8fca7d6f335f659a8967bad423770e634"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="dc5ca96695cab87b4c2fcd7c9f046ae3415a70a5"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="71f5a35e3bc1801847413cff1f14fc3b5cd991ca"/>

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="999e945b85c578c503ad445c2285940f16aacdae">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="af9a0a24fb9f4c5ced3602bc14053bd49b136344"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="965a7a2c6e3ab0e2dabcbbce69156dfb17403ccc"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="d61daef8fca7d6f335f659a8967bad423770e634"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

Просмотреть файл

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="af9a0a24fb9f4c5ced3602bc14053bd49b136344"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="965a7a2c6e3ab0e2dabcbbce69156dfb17403ccc"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="d61daef8fca7d6f335f659a8967bad423770e634"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>

Просмотреть файл

@ -17,7 +17,7 @@
</project>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="af9a0a24fb9f4c5ced3602bc14053bd49b136344"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="965a7a2c6e3ab0e2dabcbbce69156dfb17403ccc"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="d61daef8fca7d6f335f659a8967bad423770e634"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="dc5ca96695cab87b4c2fcd7c9f046ae3415a70a5"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="71f5a35e3bc1801847413cff1f14fc3b5cd991ca"/>

Просмотреть файл

@ -4,6 +4,6 @@
"remote": "",
"branch": ""
},
"revision": "075c487ef7d017a8d3c1c65e2e76a8e949f58cc8",
"revision": "043ae63fa3eac2eb69342ebe42d2a263065b3bdc",
"repo_path": "/integration/gaia-central"
}

Просмотреть файл

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="af9a0a24fb9f4c5ced3602bc14053bd49b136344"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="965a7a2c6e3ab0e2dabcbbce69156dfb17403ccc"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="d61daef8fca7d6f335f659a8967bad423770e634"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

Просмотреть файл

@ -15,7 +15,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="af9a0a24fb9f4c5ced3602bc14053bd49b136344"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="965a7a2c6e3ab0e2dabcbbce69156dfb17403ccc"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="d61daef8fca7d6f335f659a8967bad423770e634"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

Просмотреть файл

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="af9a0a24fb9f4c5ced3602bc14053bd49b136344"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="965a7a2c6e3ab0e2dabcbbce69156dfb17403ccc"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="d61daef8fca7d6f335f659a8967bad423770e634"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="dc5ca96695cab87b4c2fcd7c9f046ae3415a70a5"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="71f5a35e3bc1801847413cff1f14fc3b5cd991ca"/>

Просмотреть файл

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="af9a0a24fb9f4c5ced3602bc14053bd49b136344"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="965a7a2c6e3ab0e2dabcbbce69156dfb17403ccc"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="d61daef8fca7d6f335f659a8967bad423770e634"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

Просмотреть файл

@ -127,7 +127,6 @@
#include "nsIDOMMozSmsMessage.h"
#include "nsIDOMMozMmsMessage.h"
#include "nsIDOMSmsFilter.h"
#include "nsIDOMSmsSegmentInfo.h"
#include "nsIDOMMozMobileMessageThread.h"
#ifdef MOZ_B2G_FM
@ -353,9 +352,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
NS_DEFINE_CLASSINFO_DATA(MozSmsFilter, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(MozSmsSegmentInfo, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(MozMobileMessageThread, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
@ -942,10 +938,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozSmsFilter)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(MozSmsSegmentInfo, nsIDOMMozSmsSegmentInfo)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozSmsSegmentInfo)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(MozMobileMessageThread, nsIDOMMozMobileMessageThread)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozMobileMessageThread)
DOM_CLASSINFO_MAP_END

Просмотреть файл

@ -56,7 +56,6 @@ DOMCI_CLASS(ModalContentWindow)
DOMCI_CLASS(MozSmsMessage)
DOMCI_CLASS(MozMmsMessage)
DOMCI_CLASS(MozSmsFilter)
DOMCI_CLASS(MozSmsSegmentInfo)
DOMCI_CLASS(MozMobileMessageThread)
// @font-face in CSS

Просмотреть файл

@ -10,7 +10,6 @@ XPIDL_SOURCES += [
'nsIDOMMozMobileMessageThread.idl',
'nsIDOMMozSmsMessage.idl',
'nsIDOMSmsFilter.idl',
'nsIDOMSmsSegmentInfo.idl',
'nsIMmsService.idl',
'nsIMobileMessageCallback.idl',
'nsIMobileMessageCursorCallback.idl',

Просмотреть файл

@ -1,16 +0,0 @@
/* 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 "nsISupports.idl"
[scriptable, builtinclass, uuid(57ac3989-531e-4928-998b-53fde81a05a6)]
interface nsIDOMMozSmsSegmentInfo : nsISupports
{
/* The number of total segments for the input string. */
readonly attribute long segments;
/* The number of characters available per segment. */
readonly attribute long charsPerSegment;
/* The maximum number of available characters in the last segment. */
readonly attribute long charsAvailableInLastSegment;
};

Просмотреть файл

@ -3,9 +3,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
#include "nsIDOMSmsSegmentInfo.idl"
[scriptable, uuid(0e6f8ace-cc59-11e3-aad5-e32847abfda1)]
[scriptable, uuid(35279dbc-9f1d-419f-b17a-230fcf49f0c7)]
interface nsIMobileMessageCallback : nsISupports
{
/**
@ -45,7 +44,9 @@ interface nsIMobileMessageCallback : nsISupports
void notifyMessageMarkedRead(in boolean read);
void notifyMarkMessageReadFailed(in long error);
void notifySegmentInfoForTextGot(in nsIDOMMozSmsSegmentInfo info);
void notifySegmentInfoForTextGot(in long segments,
in long charsPerSegment,
in long charsAvailableInLastSegment);
void notifyGetSegmentInfoForTextFailed(in long error);
/**

Просмотреть файл

@ -8,14 +8,13 @@ interface nsIDeletedMessageInfo;
interface nsIDOMMozSmsMessage;
interface nsIDOMMozMmsMessage;
interface nsIDOMMozMobileMessageThread;
interface nsIDOMMozSmsSegmentInfo;
%{C++
#define MOBILE_MESSAGE_SERVICE_CID { 0x829c1dd6, 0x0466, 0x4591, { 0x83, 0x6f, 0xb8, 0xf6, 0xfd, 0x1f, 0x7b, 0xa5 } }
#define MOBILE_MESSAGE_SERVICE_CONTRACTID "@mozilla.org/mobilemessage/mobilemessageservice;1"
%}
[scriptable, builtinclass, uuid(afb83948-003a-11e4-899b-bb8a8d45e7f0)]
[scriptable, builtinclass, uuid(bc28e604-53ee-4be9-af20-268ce9efc61a)]
interface nsIMobileMessageService : nsISupports
{
[implicit_jscontext]
@ -50,10 +49,6 @@ interface nsIMobileMessageService : nsISupports
in unsigned long long expiryDate,
in boolean readReportRequested);
nsIDOMMozSmsSegmentInfo createSmsSegmentInfo(in long segments,
in long charsPerSegment,
in long charsAvailableInLastSegment);
[implicit_jscontext]
nsIDOMMozMobileMessageThread createThread(in unsigned long long id,
in jsval participants,

Просмотреть файл

@ -5,7 +5,6 @@
#include "nsISupports.idl"
interface nsIDOMMozSmsMessage;
interface nsIDOMMozSmsSegmentInfo;
interface nsIMobileMessageCallback;
%{C++

Просмотреть файл

@ -4,11 +4,11 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "MobileMessageCallback.h"
#include "mozilla/dom/ToJSValue.h"
#include "nsContentUtils.h"
#include "nsCxPusher.h"
#include "nsIDOMMozSmsMessage.h"
#include "nsIDOMMozMmsMessage.h"
#include "nsIDOMSmsSegmentInfo.h"
#include "nsIScriptGlobalObject.h"
#include "nsPIDOMWindow.h"
#include "MmsMessage.h"
@ -226,9 +226,28 @@ MobileMessageCallback::NotifyMarkMessageReadFailed(int32_t aError)
}
NS_IMETHODIMP
MobileMessageCallback::NotifySegmentInfoForTextGot(nsIDOMMozSmsSegmentInfo *aInfo)
MobileMessageCallback::NotifySegmentInfoForTextGot(int32_t aSegments,
int32_t aCharsPerSegment,
int32_t aCharsAvailableInLastSegment)
{
return NotifySuccess(aInfo, true);
AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.Init(mDOMRequest->GetOwner()))) {
return NotifyError(nsIMobileMessageCallback::INTERNAL_ERROR);
}
SmsSegmentInfo info;
info.mSegments = aSegments;
info.mCharsPerSegment = aCharsPerSegment;
info.mCharsAvailableInLastSegment = aCharsAvailableInLastSegment;
JSContext* cx = jsapi.cx();
JS::Rooted<JS::Value> val(cx);
if (!ToJSValue(cx, info, &val)) {
JS_ClearPendingException(cx);
return NotifyError(nsIMobileMessageCallback::INTERNAL_ERROR);
}
return NotifySuccess(val, true);
}
NS_IMETHODIMP

Просмотреть файл

@ -6,7 +6,6 @@
#include "MmsMessage.h"
#include "MobileMessageThread.h"
#include "MobileMessageService.h"
#include "SmsSegmentInfo.h"
#include "DeletedMessageInfo.h"
namespace mozilla {
@ -101,18 +100,6 @@ MobileMessageService::CreateMmsMessage(int32_t aId,
aMessage);
}
NS_IMETHODIMP
MobileMessageService::CreateSmsSegmentInfo(int32_t aSegments,
int32_t aCharsPerSegment,
int32_t aCharsAvailableInLastSegment,
nsIDOMMozSmsSegmentInfo** aSegmentInfo)
{
nsCOMPtr<nsIDOMMozSmsSegmentInfo> info =
new SmsSegmentInfo(aSegments, aCharsPerSegment, aCharsAvailableInLastSegment);
info.forget(aSegmentInfo);
return NS_OK;
}
NS_IMETHODIMP
MobileMessageService::CreateThread(uint64_t aId,
JS::Handle<JS::Value> aParticipants,

Просмотреть файл

@ -1,65 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 "SmsSegmentInfo.h"
#include "nsIDOMClassInfo.h"
using namespace mozilla::dom::mobilemessage;
DOMCI_DATA(MozSmsSegmentInfo, mozilla::dom::SmsSegmentInfo)
namespace mozilla {
namespace dom {
NS_INTERFACE_MAP_BEGIN(SmsSegmentInfo)
NS_INTERFACE_MAP_ENTRY(nsIDOMMozSmsSegmentInfo)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozSmsSegmentInfo)
NS_INTERFACE_MAP_END
NS_IMPL_ADDREF(SmsSegmentInfo)
NS_IMPL_RELEASE(SmsSegmentInfo)
SmsSegmentInfo::SmsSegmentInfo(int32_t aSegments,
int32_t aCharsPerSegment,
int32_t aCharsAvailableInLastSegment)
: mData(aSegments, aCharsPerSegment, aCharsAvailableInLastSegment)
{
}
SmsSegmentInfo::SmsSegmentInfo(const SmsSegmentInfoData& aData)
: mData(aData)
{
}
NS_IMETHODIMP
SmsSegmentInfo::GetSegments(int32_t* aSegments)
{
*aSegments = mData.segments();
return NS_OK;
}
NS_IMETHODIMP
SmsSegmentInfo::GetCharsPerSegment(int32_t* aCharsPerSegment)
{
*aCharsPerSegment = mData.charsPerSegment();
return NS_OK;
}
NS_IMETHODIMP
SmsSegmentInfo::GetCharsAvailableInLastSegment(int32_t* aCharsAvailableInLastSegment)
{
*aCharsAvailableInLastSegment = mData.charsAvailableInLastSegment();
return NS_OK;
}
const SmsSegmentInfoData&
SmsSegmentInfo::GetData() const
{
return mData;
}
} // namespace dom
} // namespace mozilla

Просмотреть файл

@ -1,39 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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_mobilemessage_SmsSegmentInfo_h
#define mozilla_dom_mobilemessage_SmsSegmentInfo_h
#include "nsIDOMSmsSegmentInfo.h"
#include "mozilla/Attributes.h"
#include "mozilla/dom/mobilemessage/SmsTypes.h"
namespace mozilla {
namespace dom {
class SmsSegmentInfo MOZ_FINAL : public nsIDOMMozSmsSegmentInfo
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMMOZSMSSEGMENTINFO
SmsSegmentInfo(int32_t aSegments,
int32_t aCharsPerSegment,
int32_t aCharsAvailableInLastSegment);
SmsSegmentInfo(const mobilemessage::SmsSegmentInfoData& aData);
const mobilemessage::SmsSegmentInfoData& GetData() const;
private:
~SmsSegmentInfo() {}
mobilemessage::SmsSegmentInfoData mData;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_mobilemessage_SmsSegmentInfo_h

Просмотреть файл

@ -5,7 +5,6 @@
#include "SmsMessage.h"
#include "SmsService.h"
#include "SmsSegmentInfo.h"
#include "AndroidBridge.h"
namespace mozilla {

Просмотреть файл

@ -5,7 +5,6 @@
#include "SmsMessage.h"
#include "SmsService.h"
#include "SmsSegmentInfo.h"
#include "mozilla/Preferences.h"
#include "nsServiceManagerUtils.h"

Просмотреть файл

@ -74,7 +74,9 @@ struct ReplyMarkeMessageReadFail
struct ReplyGetSegmentInfoForText
{
SmsSegmentInfoData infoData;
int32_t segments;
int32_t charsPerSegment;
int32_t charsAvailableInLastSegment;
};
struct ReplyGetSegmentInfoForTextFail

Просмотреть файл

@ -5,7 +5,6 @@
#include "SmsChild.h"
#include "SmsMessage.h"
#include "MmsMessage.h"
#include "SmsSegmentInfo.h"
#include "DeletedMessageInfo.h"
#include "nsIObserverService.h"
#include "mozilla/Services.h"
@ -246,10 +245,11 @@ SmsRequestChild::Recv__delete__(const MessageReply& aReply)
mReplyRequest->NotifyMarkMessageReadFailed(aReply.get_ReplyMarkeMessageReadFail().error());
break;
case MessageReply::TReplyGetSegmentInfoForText: {
const SmsSegmentInfoData& data =
aReply.get_ReplyGetSegmentInfoForText().infoData();
nsCOMPtr<nsIDOMMozSmsSegmentInfo> info = new SmsSegmentInfo(data);
mReplyRequest->NotifySegmentInfoForTextGot(info);
const ReplyGetSegmentInfoForText& reply =
aReply.get_ReplyGetSegmentInfoForText();
mReplyRequest->NotifySegmentInfoForTextGot(reply.segments(),
reply.charsPerSegment(),
reply.charsAvailableInLastSegment());
}
break;
case MessageReply::TReplyGetSegmentInfoForTextFail:

Просмотреть файл

@ -9,7 +9,6 @@
#include "mozilla/dom/mobilemessage/SmsChild.h"
#include "SmsMessage.h"
#include "SmsFilter.h"
#include "SmsSegmentInfo.h"
#include "nsJSUtils.h"
#include "nsCxPusher.h"
#include "mozilla/dom/MozMobileMessageManagerBinding.h"

Просмотреть файл

@ -15,7 +15,6 @@
#include "MmsMessage.h"
#include "nsIMobileMessageDatabaseService.h"
#include "SmsFilter.h"
#include "SmsSegmentInfo.h"
#include "MobileMessageThread.h"
#include "nsIDOMFile.h"
#include "mozilla/dom/ipc/Blob.h"
@ -712,10 +711,13 @@ SmsRequestParent::NotifyMarkMessageReadFailed(int32_t aError)
}
NS_IMETHODIMP
SmsRequestParent::NotifySegmentInfoForTextGot(nsIDOMMozSmsSegmentInfo *aInfo)
SmsRequestParent::NotifySegmentInfoForTextGot(int32_t aSegments,
int32_t aCharsPerSegment,
int32_t aCharsAvailableInLastSegment)
{
SmsSegmentInfo* info = static_cast<SmsSegmentInfo*>(aInfo);
return SendReply(ReplyGetSegmentInfoForText(info->GetData()));
return SendReply(ReplyGetSegmentInfoForText(aSegments,
aCharsPerSegment,
aCharsAvailableInLastSegment));
}
NS_IMETHODIMP

Просмотреть файл

@ -17,13 +17,6 @@ namespace mozilla {
namespace dom {
namespace mobilemessage {
struct SmsSegmentInfoData
{
int32_t segments;
int32_t charsPerSegment;
int32_t charsAvailableInLastSegment;
};
struct SmsMessageData
{
int32_t id;

Просмотреть файл

@ -42,7 +42,6 @@ EXPORTS.mozilla.dom += [
'MobileMessageManager.h',
'SmsFilter.h',
'SmsMessage.h',
'SmsSegmentInfo.h',
]
UNIFIED_SOURCES += [
@ -60,7 +59,6 @@ UNIFIED_SOURCES += [
'MobileMessageThread.cpp',
'SmsFilter.cpp',
'SmsMessage.cpp',
'SmsSegmentInfo.cpp',
'SmsServicesFactory.cpp',
]

Просмотреть файл

@ -22,6 +22,7 @@ function pushPrefEnv(aPrefs) {
let deferred = Promise.defer();
SpecialPowers.pushPrefEnv(aPrefs, function() {
ok(true, "preferences pushed: " + JSON.stringify(aPrefs));
deferred.resolve();
});

Просмотреть файл

@ -2,111 +2,48 @@
* http://creativecommons.org/publicdomain/zero/1.0/ */
MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = 'head.js';
// Copied from dom/system/gonk/ril_consts.js.
const PDU_MAX_USER_DATA_7BIT = 160;
SpecialPowers.setBoolPref("dom.sms.enabled", true);
SpecialPowers.addPermission("sms", true, document);
function test(text, segments, charsPerSegment, charsAvailableInLastSegment) {
log("Testing '" + text + "' ...");
let manager = window.navigator.mozMobileMessage;
ok(manager instanceof MozMobileMessageManager,
"manager is instance of " + manager.constructor);
let domRequest = manager.getSegmentInfoForText(text);
ok(domRequest, "DOMRequest object returned.");
let tasks = {
// List of test fuctions. Each of them should call |tasks.next()| when
// completed or |tasks.finish()| to jump to the last one.
_tasks: [],
_nextTaskIndex: 0,
return wrapDomRequestAsPromise(domRequest)
.then(function(aEvent) {
let result = aEvent.target.result;
ok(result, "aEvent.target.result = " + JSON.stringify(result));
push: function(func) {
this._tasks.push(func);
},
next: function() {
let index = this._nextTaskIndex++;
let task = this._tasks[index];
try {
task();
} catch (ex) {
ok(false, "test task[" + index + "] throws: " + ex);
// Run last task as clean up if possible.
if (index != this._tasks.length - 1) {
this.finish();
}
}
},
finish: function() {
this._tasks[this._tasks.length - 1]();
},
run: function() {
this.next();
}
};
function addTest(text, segments, charsPerSegment, charsAvailableInLastSegment) {
tasks.push(function() {
log("Testing '" + text + "' ...");
let domRequest = manager.getSegmentInfoForText(text);
ok(domRequest, "DOMRequest object returned.");
domRequest.onsuccess = function(e) {
log("Received 'onsuccess' DOMRequest event.");
let result = e.target.result;
if (!result) {
ok(false, "getSegmentInfoForText() result is not valid.");
tasks.finish();
return;
}
is(result.segments, segments, "info.segments");
is(result.charsPerSegment, charsPerSegment, "info.charsPerSegment");
is(result.segments, segments, "result.segments");
is(result.charsPerSegment, charsPerSegment, "result.charsPerSegment");
is(result.charsAvailableInLastSegment, charsAvailableInLastSegment,
"info.charsAvailableInLastSegment");
tasks.next();
};
domRequest.onerror = function(e) {
ok(false, "Failed to call getSegmentInfoForText().");
tasks.finish();
};
});
"result.charsAvailableInLastSegment");
});
}
addTest(null, 1, PDU_MAX_USER_DATA_7BIT,
PDU_MAX_USER_DATA_7BIT - "null".length);
startTestCommon(function() {
// Ensure we always begin with strict 7bit encoding set to false.
return pushPrefEnv({ set: [["dom.sms.strict7BitEncoding", false]] })
// Testing "undefined".
addTest(undefined, 1, PDU_MAX_USER_DATA_7BIT,
PDU_MAX_USER_DATA_7BIT - "undefined".length);
.then(() => test(null, 1, PDU_MAX_USER_DATA_7BIT, (PDU_MAX_USER_DATA_7BIT - "null".length)))
.then(() => test(undefined, 1, PDU_MAX_USER_DATA_7BIT, (PDU_MAX_USER_DATA_7BIT - "undefined".length)))
// Testing numeric values.
addTest(0, 1, PDU_MAX_USER_DATA_7BIT, PDU_MAX_USER_DATA_7BIT - "0".length);
addTest(1.0, 1, PDU_MAX_USER_DATA_7BIT, PDU_MAX_USER_DATA_7BIT - "1".length);
.then(() => test(0, 1, PDU_MAX_USER_DATA_7BIT, (PDU_MAX_USER_DATA_7BIT - "0".length)))
.then(() => test(1.0, 1, PDU_MAX_USER_DATA_7BIT, (PDU_MAX_USER_DATA_7BIT - "1".length)))
// Testing empty object. The empty object extends to "[object Object]" and both
// '[' and ']' are in default single shift table, so each of them takes two
// septets.
addTest({}, 1, PDU_MAX_USER_DATA_7BIT,
PDU_MAX_USER_DATA_7BIT - (("" + {}).length + 2));
// Testing empty object. The empty object extends to "[object Object]" and
// both '[' and ']' are in default single shift table, so each of them
// takes two septets.
.then(() => test({}, 1, PDU_MAX_USER_DATA_7BIT, (PDU_MAX_USER_DATA_7BIT - (("" + {}).length + 2))))
// Testing Date object.
let date = new Date();
addTest(date, 1, PDU_MAX_USER_DATA_7BIT,
PDU_MAX_USER_DATA_7BIT - ("" + date).length);
.then(function() {
let date = new Date();
return test(date, 1, PDU_MAX_USER_DATA_7BIT, (PDU_MAX_USER_DATA_7BIT - ("" + date).length));
})
addTest("", 1, PDU_MAX_USER_DATA_7BIT,
PDU_MAX_USER_DATA_7BIT - "".length);
// WARNING: All tasks should be pushed before this!!!
tasks.push(function cleanUp() {
SpecialPowers.removePermission("sms", document);
SpecialPowers.clearUserPref("dom.sms.enabled");
finish();
.then(() => test("", 1, PDU_MAX_USER_DATA_7BIT, (PDU_MAX_USER_DATA_7BIT - "".length)));
});
tasks.run();

Просмотреть файл

@ -130,7 +130,7 @@ function verifySmsDeleted(smsId) {
function cleanUp() {
manager.onreceived = null;
SpecialPowers.removePermission("sms", document);
SpecialPowers.setBoolPref("dom.sms.enabled", false);
SpecialPowers.clearUserPref("dom.sms.enabled");
finish();
}

Просмотреть файл

@ -208,7 +208,7 @@ tasks.push(function cleanUp() {
manager.onreceived = null;
SpecialPowers.removePermission("sms", document);
SpecialPowers.setBoolPref("dom.sms.enabled", false);
SpecialPowers.clearUserPref("dom.sms.enabled");
log("Finish!!!");
finish();
});

Просмотреть файл

@ -2,6 +2,7 @@
* http://creativecommons.org/publicdomain/zero/1.0/ */
MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = 'head.js';
const LEN_7BIT = 160;
const LEN_7BIT_WITH_8BIT_REF = 153;
@ -10,179 +11,116 @@ const LEN_UCS2 = 70;
const LEN_UCS2_WITH_8BIT_REF = 67;
const LEN_UCS2_WITH_16BIT_REF = 66;
SpecialPowers.setBoolPref("dom.sms.enabled", true);
let currentStrict7BitEncoding = false;
SpecialPowers.setBoolPref("dom.sms.strict7BitEncoding",
currentStrict7BitEncoding);
SpecialPowers.addPermission("sms", true, document);
let manager = window.navigator.mozMobileMessage;
ok(manager instanceof MozMobileMessageManager,
"manager is instance of " + manager.constructor);
function times(str, n) {
return (new Array(n + 1)).join(str);
}
let tasks = {
// List of test fuctions. Each of them should call |tasks.next()| when
// completed or |tasks.finish()| to jump to the last one.
_tasks: [],
_nextTaskIndex: 0,
function test(text, segments, charsPerSegment, charsAvailableInLastSegment) {
// 'text' may contain non-ascii characters, so we're not going to print it on
// Marionette console to avoid breaking it.
ok(true, "Testing '" + text + "' ...");
push: function(func) {
this._tasks.push(func);
},
let domRequest = manager.getSegmentInfoForText(text);
ok(domRequest, "DOMRequest object returned.");
next: function() {
let index = this._nextTaskIndex++;
let task = this._tasks[index];
try {
task();
} catch (ex) {
ok(false, "test task[" + index + "] throws: " + ex);
// Run last task as clean up if possible.
if (index != this._tasks.length - 1) {
this.finish();
}
}
},
return wrapDomRequestAsPromise(domRequest)
.then(function(aEvent) {
let result = aEvent.target.result;
ok(result, "aEvent.target.result = " + JSON.stringify(result));
finish: function() {
this._tasks[this._tasks.length - 1]();
},
run: function() {
this.next();
}
};
function addTest(text, strict7BitEncoding, expected) {
tasks.push(function() {
if (strict7BitEncoding != currentStrict7BitEncoding) {
currentStrict7BitEncoding = strict7BitEncoding;
SpecialPowers.setBoolPref("dom.sms.strict7BitEncoding",
currentStrict7BitEncoding);
}
let domRequest = manager.getSegmentInfoForText(text);
ok(domRequest, "DOMRequest object returned.");
domRequest.onsuccess = function(e) {
log("Received 'onsuccess' DOMRequest event.");
let result = e.target.result;
if (!result) {
ok(false, "getSegmentInfoForText() result is not valid.");
tasks.finish();
return;
}
is(result.segments, expected[0], "segments");
is(result.charsPerSegment, expected[1], "charsPerSegment");
is(result.charsAvailableInLastSegment, expected[2],
"charsAvailableInLastSegment");
tasks.next();
};
domRequest.onerror = function(e) {
ok(false, "Failed to call getSegmentInfoForText().");
tasks.finish();
};
});
is(result.segments, segments, "result.segments");
is(result.charsPerSegment, charsPerSegment, "result.charsPerSegment");
is(result.charsAvailableInLastSegment, charsAvailableInLastSegment,
"result.charsAvailableInLastSegment");
});
}
// GSM 7Bit Alphabets:
//
// 'a' is in GSM default locking shift table, so it takes 1 septet.
addTest("a", false, [1, LEN_7BIT, LEN_7BIT - 1]);
// '\u20ac' is in GSM default single shift table, so it takes 2 septets.
addTest("\u20ac", false, [1, LEN_7BIT, LEN_7BIT - 2]);
// SP is defined in both locking shift and single shift tables.
addTest(" ", false, [1, LEN_7BIT, LEN_7BIT - 1]);
// Some combinations.
addTest("a\u20ac", false, [1, LEN_7BIT, LEN_7BIT - 3]);
addTest("a ", false, [1, LEN_7BIT, LEN_7BIT - 2]);
addTest("\u20aca", false, [1, LEN_7BIT, LEN_7BIT - 3]);
addTest("\u20ac ", false, [1, LEN_7BIT, LEN_7BIT - 3]);
addTest(" \u20ac", false, [1, LEN_7BIT, LEN_7BIT - 3]);
addTest(" a", false, [1, LEN_7BIT, LEN_7BIT - 2]);
startTestCommon(function() {
// Ensure we always begin with strict 7bit encoding set to false.
return pushPrefEnv({ set: [["dom.sms.strict7BitEncoding", false]] })
// GSM 7Bit Alphabets (multipart):
//
// Exactly 160 locking shift table chararacters.
addTest(times("a", LEN_7BIT), false, [1, LEN_7BIT, 0]);
// 161 locking shift table chararacters. We'll have |161 - 153 = 8| septets in
// the 2nd segment.
addTest(times("a", LEN_7BIT + 1), false,
[2, LEN_7BIT_WITH_8BIT_REF, LEN_7BIT_WITH_8BIT_REF - 8]);
// |LEN_7BIT_WITH_8BIT_REF * 2| locking shift table chararacters.
addTest(times("a", LEN_7BIT_WITH_8BIT_REF * 2), false,
[2, LEN_7BIT_WITH_8BIT_REF, 0]);
// |LEN_7BIT_WITH_8BIT_REF * 2 + 1| locking shift table chararacters.
addTest(times("a", LEN_7BIT_WITH_8BIT_REF * 2 + 1), false,
[3, LEN_7BIT_WITH_8BIT_REF, LEN_7BIT_WITH_8BIT_REF - 1]);
// Exactly 80 single shift table chararacters.
addTest(times("\u20ac", LEN_7BIT / 2), false, [1, LEN_7BIT, 0]);
// 81 single shift table chararacters. Because |Math.floor(153 / 2) = 76|, it
// should left 5 septets in the 2nd segment.
addTest(times("\u20ac", LEN_7BIT / 2 + 1), false,
[2, LEN_7BIT_WITH_8BIT_REF, LEN_7BIT_WITH_8BIT_REF - 10]);
// |1 + 2 * 76| single shift table chararacters. We have only |153 - 76 * 2 = 1|
// space left, but each single shift table character takes 2, so it will be
// filled in the 3rd segment.
addTest(times("\u20ac", 1 + 2 * Math.floor(LEN_7BIT_WITH_8BIT_REF / 2)), false,
[3, LEN_7BIT_WITH_8BIT_REF, LEN_7BIT_WITH_8BIT_REF - 2]);
// |2 * 76| single shift table chararacters + 1 locking shift table chararacter.
addTest("a" + times("\u20ac", 2 * Math.floor(LEN_7BIT_WITH_8BIT_REF / 2)), false,
[2, LEN_7BIT_WITH_8BIT_REF, 1]);
addTest(times("\u20ac", 2 * Math.floor(LEN_7BIT_WITH_8BIT_REF / 2)) + "a", false,
[2, LEN_7BIT_WITH_8BIT_REF, 0]);
// GSM 7Bit Alphabets:
//
// 'a' is in GSM default locking shift table, so it takes 1 septet.
.then(() => test("a", 1, LEN_7BIT, LEN_7BIT - 1))
// '\u20ac' is in GSM default single shift table, so it takes 2 septets.
.then(() => test("\u20ac", 1, LEN_7BIT, LEN_7BIT - 2))
// SP is defined in both locking shift and single shift tables.
.then(() => test(" ", 1, LEN_7BIT, LEN_7BIT - 1))
// Some combinations.
.then(() => test("a\u20ac", 1, LEN_7BIT, LEN_7BIT - 3))
.then(() => test("a ", 1, LEN_7BIT, LEN_7BIT - 2))
.then(() => test("\u20aca", 1, LEN_7BIT, LEN_7BIT - 3))
.then(() => test("\u20ac ", 1, LEN_7BIT, LEN_7BIT - 3))
.then(() => test(" \u20ac", 1, LEN_7BIT, LEN_7BIT - 3))
.then(() => test(" a", 1, LEN_7BIT, LEN_7BIT - 2))
// UCS2:
//
// '\u6afb' should be encoded as UCS2.
addTest("\u6afb", false, [1, LEN_UCS2, LEN_UCS2 - 1]);
// Combination of GSM 7bit alphabets.
addTest("\u6afba", false, [1, LEN_UCS2, LEN_UCS2 - 2]);
addTest("\u6afb\u20ac", false, [1, LEN_UCS2, LEN_UCS2 - 2]);
addTest("\u6afb ", false, [1, LEN_UCS2, LEN_UCS2 - 2]);
// GSM 7Bit Alphabets (multipart):
//
// Exactly 160 locking shift table chararacters.
.then(() => test(times("a", LEN_7BIT), 1, LEN_7BIT, 0))
// 161 locking shift table chararacters. We'll have |161 - 153 = 8| septets in
// the 2nd segment.
.then(() => test(times("a", LEN_7BIT + 1),
2, LEN_7BIT_WITH_8BIT_REF, LEN_7BIT_WITH_8BIT_REF - 8))
// |LEN_7BIT_WITH_8BIT_REF * 2| locking shift table chararacters.
.then(() => test(times("a", LEN_7BIT_WITH_8BIT_REF * 2),
2, LEN_7BIT_WITH_8BIT_REF, 0))
// |LEN_7BIT_WITH_8BIT_REF * 2 + 1| locking shift table chararacters.
.then(() => test(times("a", LEN_7BIT_WITH_8BIT_REF * 2 + 1),
3, LEN_7BIT_WITH_8BIT_REF, LEN_7BIT_WITH_8BIT_REF - 1))
// Exactly 80 single shift table chararacters.
.then(() => test(times("\u20ac", LEN_7BIT / 2), 1, LEN_7BIT, 0))
// 81 single shift table chararacters. Because |Math.floor(153 / 2) = 76|, it
// should left 5 septets in the 2nd segment.
.then(() => test(times("\u20ac", LEN_7BIT / 2 + 1),
2, LEN_7BIT_WITH_8BIT_REF, LEN_7BIT_WITH_8BIT_REF - 10))
// |1 + 2 * 76| single shift table chararacters. We have only |153 - 76 * 2 = 1|
// space left, but each single shift table character takes 2, so it will be
// filled in the 3rd segment.
.then(() => test(times("\u20ac", 1 + 2 * Math.floor(LEN_7BIT_WITH_8BIT_REF / 2)),
3, LEN_7BIT_WITH_8BIT_REF, LEN_7BIT_WITH_8BIT_REF - 2))
// |2 * 76| single shift table chararacters + 1 locking shift table chararacter.
.then(() => test("a" + times("\u20ac", 2 * Math.floor(LEN_7BIT_WITH_8BIT_REF / 2)),
2, LEN_7BIT_WITH_8BIT_REF, 1))
.then(() => test(times("\u20ac", 2 * Math.floor(LEN_7BIT_WITH_8BIT_REF / 2)) + "a",
2, LEN_7BIT_WITH_8BIT_REF, 0))
// UCS2 (multipart):
//
// Exactly 70 UCS2 chararacters.
addTest(times("\u6afb", LEN_UCS2), false, [1, LEN_UCS2, 0]);
// 71 UCS2 chararacters. We'll have |71 - 67 = 4| chararacters in the 2nd
// segment.
addTest(times("\u6afb", LEN_UCS2 + 1), false,
[2, LEN_UCS2_WITH_8BIT_REF, LEN_UCS2_WITH_8BIT_REF - 4]);
// |LEN_UCS2_WITH_8BIT_REF * 2| ucs2 chararacters.
addTest(times("\u6afb", LEN_UCS2_WITH_8BIT_REF * 2), false,
[2, LEN_UCS2_WITH_8BIT_REF, 0]);
// |LEN_7BIT_WITH_8BIT_REF * 2 + 1| ucs2 chararacters.
addTest(times("\u6afb", LEN_UCS2_WITH_8BIT_REF * 2 + 1), false,
[3, LEN_UCS2_WITH_8BIT_REF, LEN_UCS2_WITH_8BIT_REF - 1]);
// UCS2:
//
// '\u6afb' should be encoded as UCS2.
.then(() => test("\u6afb", 1, LEN_UCS2, LEN_UCS2 - 1))
// Combination of GSM 7bit alphabets.
.then(() => test("\u6afba", 1, LEN_UCS2, LEN_UCS2 - 2))
.then(() => test("\u6afb\u20ac", 1, LEN_UCS2, LEN_UCS2 - 2))
.then(() => test("\u6afb ", 1, LEN_UCS2, LEN_UCS2 - 2))
// Strict 7-Bit Encoding:
//
// Should have no effect on GSM default alphabet characters.
addTest("\u0041", true, [1, LEN_7BIT, LEN_7BIT - 1]);
// "\u00c0"(À) should be mapped to "\u0041"(A).
addTest("\u00c0", true, [1, LEN_7BIT, LEN_7BIT - 1]);
// Mixing mapped characters with unmapped ones.
addTest("\u00c0\u0041", true, [1, LEN_7BIT, LEN_7BIT - 2]);
addTest("\u0041\u00c0", true, [1, LEN_7BIT, LEN_7BIT - 2]);
// UCS2 characters should be mapped to '*'.
addTest("\u1234", true, [1, LEN_7BIT, LEN_7BIT - 1]);
// UCS2 (multipart):
//
// Exactly 70 UCS2 chararacters.
.then(() => test(times("\u6afb", LEN_UCS2), 1, LEN_UCS2, 0))
// 71 UCS2 chararacters. We'll have |71 - 67 = 4| chararacters in the 2nd
// segment.
.then(() => test(times("\u6afb", LEN_UCS2 + 1),
2, LEN_UCS2_WITH_8BIT_REF, LEN_UCS2_WITH_8BIT_REF - 4))
// |LEN_UCS2_WITH_8BIT_REF * 2| ucs2 chararacters.
.then(() => test(times("\u6afb", LEN_UCS2_WITH_8BIT_REF * 2),
2, LEN_UCS2_WITH_8BIT_REF, 0))
// |LEN_7BIT_WITH_8BIT_REF * 2 + 1| ucs2 chararacters.
.then(() => test(times("\u6afb", LEN_UCS2_WITH_8BIT_REF * 2 + 1),
3, LEN_UCS2_WITH_8BIT_REF, LEN_UCS2_WITH_8BIT_REF - 1))
// Strict 7-Bit Encoding:
//
.then(() => pushPrefEnv({ set: [["dom.sms.strict7BitEncoding", true]] }))
// WARNING: All tasks should be pushed before this!!!
tasks.push(function cleanUp() {
SpecialPowers.removePermission("sms", document);
SpecialPowers.clearUserPref("dom.sms.enabled");
SpecialPowers.clearUserPref("dom.sms.strict7BitEncoding");
finish();
// Should have no effect on GSM default alphabet characters.
.then(() => test("\u0041", 1, LEN_7BIT, LEN_7BIT - 1))
// "\u00c0"(À) should be mapped to "\u0041"(A).
.then(() => test("\u00c0", 1, LEN_7BIT, LEN_7BIT - 1))
// Mixing mapped characters with unmapped ones.
.then(() => test("\u00c0\u0041", 1, LEN_7BIT, LEN_7BIT - 2))
.then(() => test("\u0041\u00c0", 1, LEN_7BIT, LEN_7BIT - 2))
// UCS2 characters should be mapped to '*'.
.then(() => test("\u1234", 1, LEN_7BIT, LEN_7BIT - 1));
});
tasks.run();

Просмотреть файл

@ -4240,11 +4240,9 @@ RadioInterface.prototype = {
charsInLastSegment = 0;
}
let result = gMobileMessageService
.createSmsSegmentInfo(options.segmentMaxSeq,
options.segmentChars,
options.segmentChars - charsInLastSegment);
request.notifySegmentInfoForTextGot(result);
request.notifySegmentInfoForTextGot(options.segmentMaxSeq,
options.segmentChars,
options.segmentChars - charsInLastSegment);
},
getSmscAddress: function(request) {

Просмотреть файл

@ -707,8 +707,6 @@ var interfaceNamesInGlobalScope =
"MozSmsFilter",
// IMPORTANT: Do not change this list without review from a DOM peer!
"MozSmsMessage",
// IMPORTANT: Do not change this list without review from a DOM peer!
"MozSmsSegmentInfo",
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "MozSpeakerManager", b2g: true},
// IMPORTANT: Do not change this list without review from a DOM peer!

Просмотреть файл

@ -8,6 +8,26 @@ interface MozMmsMessage;
interface MozSmsFilter;
interface MozSmsMessage;
dictionary SmsSegmentInfo {
/**
* The number of total segments for the input string. The value is always
* larger-equal than 1.
*/
long segments = 0;
/**
* The number of characters available per segment. The value is always
* larger-equal than 1.
*/
long charsPerSegment = 0;
/**
* The maximum number of available characters in the last segment. The value
* is always larger-equal than 0.
*/
long charsAvailableInLastSegment = 0;
};
dictionary MmsAttachment {
DOMString? id = null;
DOMString? location = null;

Просмотреть файл

@ -1065,11 +1065,7 @@ AndroidBridge::GetSegmentInfoForText(const nsAString& aText,
#else
ALOG_BRIDGE("AndroidBridge::GetSegmentInfoForText");
dom::mobilemessage::SmsSegmentInfoData data;
data.segments() = 0;
data.charsPerSegment() = 0;
data.charsAvailableInLastSegment() = 0;
int32_t segments, charsPerSegment, charsAvailableInLastSegment;
JNIEnv *env = GetJNIEnv();
@ -1086,17 +1082,18 @@ AndroidBridge::GetSegmentInfoForText(const nsAString& aText,
jint* info = env->GetIntArrayElements(arr, JNI_FALSE);
data.segments() = info[0]; // msgCount
data.charsPerSegment() = info[2]; // codeUnitsRemaining
segments = info[0]; // msgCount
charsPerSegment = info[2]; // codeUnitsRemaining
// segmentChars = (codeUnitCount + codeUnitsRemaining) / msgCount
data.charsAvailableInLastSegment() = (info[1] + info[2]) / info[0];
charsAvailableInLastSegment = (info[1] + info[2]) / info[0];
env->ReleaseIntArrayElements(arr, info, JNI_ABORT);
// TODO Bug 908598 - Should properly use |QueueSmsRequest(...)| to queue up
// the nsIMobileMessageCallback just like other functions.
nsCOMPtr<nsIDOMMozSmsSegmentInfo> info = new SmsSegmentInfo(data);
return aRequest->NotifySegmentInfoForTextGot(info);
return aRequest->NotifySegmentInfoForTextGot(segments,
charsPerSegment,
charsAvailableInLastSegment);
#endif
}

Просмотреть файл

@ -59,7 +59,6 @@ class NetworkInformation;
namespace dom {
namespace mobilemessage {
struct SmsFilterData;
struct SmsSegmentInfoData;
} // namespace mobilemessage
} // namespace dom