Bug 916607 - 2/4: implementation. r=bzbarsky, r=gene
authorVicamo Yang <vyang@mozilla.com>
Mon, 04 Aug 2014 17:01:36 +0800
changeset 197470 93cf77271f0f1c56d21af600849a5819f93788b0
parent 197469 af90d93bf853006781b468176417e5bb7599a75e
child 197471 e2d5cf427ed419d2718647fa4bd70fd4f34e1277
push id27247
push userryanvm@gmail.com
push dateMon, 04 Aug 2014 19:47:25 +0000
treeherdermozilla-central@adb44e1f7559 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky, gene
bugs916607
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 916607 - 2/4: implementation. r=bzbarsky, r=gene
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfoClasses.h
dom/mobilemessage/src/MobileMessageCallback.cpp
dom/mobilemessage/src/MobileMessageService.cpp
dom/mobilemessage/src/SmsSegmentInfo.cpp
dom/mobilemessage/src/SmsSegmentInfo.h
dom/mobilemessage/src/android/SmsService.cpp
dom/mobilemessage/src/gonk/SmsService.cpp
dom/mobilemessage/src/ipc/SmsChild.cpp
dom/mobilemessage/src/ipc/SmsIPCService.cpp
dom/mobilemessage/src/ipc/SmsParent.cpp
dom/mobilemessage/src/moz.build
dom/system/gonk/RadioInterfaceLayer.js
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -122,17 +122,16 @@
 #include "mozilla/dom/TouchEvent.h"
 
 #include "nsWrapperCacheInlines.h"
 #include "mozilla/dom/HTMLCollectionBinding.h"
 
 #include "nsIDOMMozSmsMessage.h"
 #include "nsIDOMMozMmsMessage.h"
 #include "nsIDOMSmsFilter.h"
-#include "nsIDOMSmsSegmentInfo.h"
 #include "nsIDOMMozMobileMessageThread.h"
 
 #ifdef MOZ_B2G_FM
 #include "FMRadio.h"
 #endif
 
 #include "nsIDOMGlobalObjectConstructor.h"
 #include "nsDebug.h"
@@ -348,19 +347,16 @@ static nsDOMClassInfoData sClassInfoData
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
 
   NS_DEFINE_CLASSINFO_DATA(MozMmsMessage, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
 
   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)
 
   NS_DEFINE_CLASSINFO_DATA(CSSFontFaceRule, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
 
   NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(ContentFrameMessageManager, nsEventTargetSH,
                                        DOM_DEFAULT_SCRIPTABLE_FLAGS |
@@ -937,20 +933,16 @@ nsDOMClassInfo::Init()
   DOM_CLASSINFO_MAP_BEGIN(MozMmsMessage, nsIDOMMozMmsMessage)
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozMmsMessage)
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(MozSmsFilter, nsIDOMMozSmsFilter)
      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
 
   DOM_CLASSINFO_MAP_BEGIN(CSSFontFaceRule, nsIDOMCSSFontFaceRule)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSFontFaceRule)
   DOM_CLASSINFO_MAP_END
 
--- a/dom/base/nsDOMClassInfoClasses.h
+++ b/dom/base/nsDOMClassInfoClasses.h
@@ -51,17 +51,16 @@ DOMCI_CLASS(Blob)
 DOMCI_CLASS(File)
 
 // DOM modal content window class, almost identical to Window
 DOMCI_CLASS(ModalContentWindow)
 
 DOMCI_CLASS(MozSmsMessage)
 DOMCI_CLASS(MozMmsMessage)
 DOMCI_CLASS(MozSmsFilter)
-DOMCI_CLASS(MozSmsSegmentInfo)
 DOMCI_CLASS(MozMobileMessageThread)
 
 // @font-face in CSS
 DOMCI_CLASS(CSSFontFaceRule)
 
 DOMCI_CLASS(ContentFrameMessageManager)
 DOMCI_CLASS(ChromeMessageBroadcaster)
 DOMCI_CLASS(ChromeMessageSender)
--- a/dom/mobilemessage/src/MobileMessageCallback.cpp
+++ b/dom/mobilemessage/src/MobileMessageCallback.cpp
@@ -1,19 +1,19 @@
 /* -*- 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 "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"
 #include "mozilla/dom/ScriptSettings.h"
 #include "jsapi.h"
 #include "xpcpublic.h"
 #include "nsServiceManagerUtils.h"
 #include "nsTArrayHelpers.h"
@@ -221,19 +221,38 @@ MobileMessageCallback::NotifyMessageMark
 
 NS_IMETHODIMP
 MobileMessageCallback::NotifyMarkMessageReadFailed(int32_t aError)
 {
   return NotifyError(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
 MobileMessageCallback::NotifyGetSegmentInfoForTextFailed(int32_t aError)
 {
   return NotifyError(aError, nullptr, true);
 }
 
--- a/dom/mobilemessage/src/MobileMessageService.cpp
+++ b/dom/mobilemessage/src/MobileMessageService.cpp
@@ -1,17 +1,16 @@
 /* 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 "SmsMessage.h"
 #include "MmsMessage.h"
 #include "MobileMessageThread.h"
 #include "MobileMessageService.h"
-#include "SmsSegmentInfo.h"
 #include "DeletedMessageInfo.h"
 
 namespace mozilla {
 namespace dom {
 namespace mobilemessage {
 
 NS_IMPL_ISUPPORTS(MobileMessageService, nsIMobileMessageService)
 
@@ -97,28 +96,16 @@ MobileMessageService::CreateMmsMessage(i
                             aAttachments,
                             aExpiryDate,
                             aReadReportRequested,
                             aCx,
                             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,
                                    uint64_t aTimestamp,
                                    const nsAString& aLastMessageSubject,
                                    const nsAString& aBody,
                                    uint64_t aUnreadCount,
                                    const nsAString& aLastMessageType,
                                    JSContext* aCx,
deleted file mode 100644
--- a/dom/mobilemessage/src/SmsSegmentInfo.cpp
+++ /dev/null
@@ -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
deleted file mode 100644
--- a/dom/mobilemessage/src/SmsSegmentInfo.h
+++ /dev/null
@@ -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
--- a/dom/mobilemessage/src/android/SmsService.cpp
+++ b/dom/mobilemessage/src/android/SmsService.cpp
@@ -1,16 +1,15 @@
 /* -*- 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 "SmsMessage.h"
 #include "SmsService.h"
-#include "SmsSegmentInfo.h"
 #include "AndroidBridge.h"
 
 namespace mozilla {
 namespace dom {
 namespace mobilemessage {
 
 NS_IMPL_ISUPPORTS(SmsService, nsISmsService)
 
--- a/dom/mobilemessage/src/gonk/SmsService.cpp
+++ b/dom/mobilemessage/src/gonk/SmsService.cpp
@@ -1,16 +1,15 @@
 /* -*- 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 "SmsMessage.h"
 #include "SmsService.h"
-#include "SmsSegmentInfo.h"
 #include "mozilla/Preferences.h"
 #include "nsServiceManagerUtils.h"
 
 namespace {
 
 const char* kPrefRilNumRadioInterfaces = "ril.numRadioInterfaces";
 #define kPrefDefaultServiceId "dom.sms.defaultServiceId"
 const char* kObservedPrefs[] = {
--- a/dom/mobilemessage/src/ipc/SmsChild.cpp
+++ b/dom/mobilemessage/src/ipc/SmsChild.cpp
@@ -1,16 +1,15 @@
 /* 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 "SmsChild.h"
 #include "SmsMessage.h"
 #include "MmsMessage.h"
-#include "SmsSegmentInfo.h"
 #include "DeletedMessageInfo.h"
 #include "nsIObserverService.h"
 #include "mozilla/Services.h"
 #include "mozilla/dom/ContentChild.h"
 #include "mozilla/dom/mobilemessage/Constants.h" // For MessageType
 #include "MobileMessageThread.h"
 #include "MainThreadUtils.h"
 
@@ -241,20 +240,21 @@ SmsRequestChild::Recv__delete__(const Me
       break;
     case MessageReply::TReplyMarkeMessageRead:
       mReplyRequest->NotifyMessageMarkedRead(aReply.get_ReplyMarkeMessageRead().read());
       break;
     case MessageReply::TReplyMarkeMessageReadFail:
       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:
       mReplyRequest->NotifyGetSegmentInfoForTextFailed(
         aReply.get_ReplyGetSegmentInfoForTextFail().error());
       break;
     case MessageReply::TReplyGetSmscAddress:
       mReplyRequest->NotifyGetSmscAddress(aReply.get_ReplyGetSmscAddress().smscAddress());
--- a/dom/mobilemessage/src/ipc/SmsIPCService.cpp
+++ b/dom/mobilemessage/src/ipc/SmsIPCService.cpp
@@ -4,17 +4,16 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/dom/ContentChild.h"
 #include "SmsIPCService.h"
 #include "nsXULAppAPI.h"
 #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"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/Preferences.h"
 #include "nsString.h"
 
 using namespace mozilla::dom;
--- a/dom/mobilemessage/src/ipc/SmsParent.cpp
+++ b/dom/mobilemessage/src/ipc/SmsParent.cpp
@@ -10,17 +10,16 @@
 #include "mozilla/Services.h"
 #include "nsIDOMMozSmsMessage.h"
 #include "nsIDOMMozMmsMessage.h"
 #include "mozilla/unused.h"
 #include "SmsMessage.h"
 #include "MmsMessage.h"
 #include "nsIMobileMessageDatabaseService.h"
 #include "SmsFilter.h"
-#include "SmsSegmentInfo.h"
 #include "MobileMessageThread.h"
 #include "nsIDOMFile.h"
 #include "mozilla/dom/ipc/Blob.h"
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/dom/mobilemessage/Constants.h" // For MessageType
 #include "nsContentUtils.h"
 #include "nsTArrayHelpers.h"
 #include "nsCxPusher.h"
@@ -707,20 +706,23 @@ SmsRequestParent::NotifyMessageMarkedRea
 
 NS_IMETHODIMP
 SmsRequestParent::NotifyMarkMessageReadFailed(int32_t aError)
 {
   return SendReply(ReplyMarkeMessageReadFail(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
 SmsRequestParent::NotifyGetSegmentInfoForTextFailed(int32_t aError)
 {
   return SendReply(ReplyGetSegmentInfoForTextFail(aError));
 }
 
--- a/dom/mobilemessage/src/moz.build
+++ b/dom/mobilemessage/src/moz.build
@@ -37,17 +37,16 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'go
     ]
 
 EXPORTS.mozilla.dom += [
     'DOMMobileMessageError.h',
     'MmsMessage.h',
     'MobileMessageManager.h',
     'SmsFilter.h',
     'SmsMessage.h',
-    'SmsSegmentInfo.h',
 ]
 
 UNIFIED_SOURCES += [
     'Constants.cpp',
     'DeletedMessageInfo.cpp',
     'DOMMobileMessageError.cpp',
     'ipc/SmsChild.cpp',
     'ipc/SmsIPCService.cpp',
@@ -55,17 +54,16 @@ UNIFIED_SOURCES += [
     'MmsMessage.cpp',
     'MobileMessageCallback.cpp',
     'MobileMessageCursorCallback.cpp',
     'MobileMessageManager.cpp',
     'MobileMessageService.cpp',
     'MobileMessageThread.cpp',
     'SmsFilter.cpp',
     'SmsMessage.cpp',
-    'SmsSegmentInfo.cpp',
     'SmsServicesFactory.cpp',
 ]
 
 IPDL_SOURCES += [
     'ipc/PMobileMessageCursor.ipdl',
     'ipc/PSms.ipdl',
     'ipc/PSmsRequest.ipdl',
     'ipc/SmsTypes.ipdlh',
--- a/dom/system/gonk/RadioInterfaceLayer.js
+++ b/dom/system/gonk/RadioInterfaceLayer.js
@@ -4235,21 +4235,19 @@ RadioInterface.prototype = {
       if (options.dcs == RIL.PDU_DCS_MSG_CODING_16BITS_ALPHABET) {
         // In UCS2 encoding, encodedBodyLength is in octets.
         charsInLastSegment /= 2;
       }
     } else {
       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) {
     this.workerMessenger.send("getSmscAddress",
                               null,
                               (function(response) {
       if (!response.errorMsg) {
         request.notifyGetSmscAddress(response.smscAddress);