Bug 674725 - Part B - Add .mozSms to navigator. r=smaug

This commit is contained in:
Mounir Lamouri 2011-11-20 22:08:33 +01:00
parent ab6911197f
commit bc905fd780
11 changed files with 143 additions and 3 deletions

View File

@ -148,6 +148,7 @@
@BINPATH@/components/dom_json.xpt
@BINPATH@/components/dom_range.xpt
@BINPATH@/components/dom_sidebar.xpt
@BINPATH@/components/dom_sms.xpt
@BINPATH@/components/dom_storage.xpt
@BINPATH@/components/dom_stylesheets.xpt
@BINPATH@/components/dom_threads.xpt

View File

@ -115,6 +115,7 @@ NS_INTERFACE_MAP_BEGIN(Navigator)
NS_INTERFACE_MAP_ENTRY(nsIDOMNavigatorGeolocation)
NS_INTERFACE_MAP_ENTRY(nsIDOMMozNavigatorBattery)
NS_INTERFACE_MAP_ENTRY(nsIDOMNavigatorDesktopNotification)
NS_INTERFACE_MAP_ENTRY(nsIDOMMozNavigatorSms)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Navigator)
NS_INTERFACE_MAP_END
@ -772,6 +773,18 @@ Navigator::GetMozBattery(nsIDOMMozBatteryManager** aBattery)
return NS_OK;
}
//*****************************************************************************
// Navigator::nsIDOMNavigatorSms
//*****************************************************************************
NS_IMETHODIMP
Navigator::GetMozSms(nsIDOMMozSmsManager** aSmsManager)
{
*aSmsManager = nsnull;
return NS_OK;
}
PRInt64
Navigator::SizeOf() const
{

View File

@ -48,6 +48,7 @@
#include "nsIDOMNavigatorDesktopNotification.h"
#include "nsIDOMClientInformation.h"
#include "nsIDOMNavigatorBattery.h"
#include "nsIDOMNavigatorSms.h"
#include "nsAutoPtr.h"
class nsPluginArray;
@ -71,7 +72,8 @@ class Navigator : public nsIDOMNavigator,
public nsIDOMClientInformation,
public nsIDOMNavigatorGeolocation,
public nsIDOMNavigatorDesktopNotification,
public nsIDOMMozNavigatorBattery
public nsIDOMMozNavigatorBattery,
public nsIDOMMozNavigatorSms
{
public:
Navigator(nsIDocShell *aDocShell);
@ -83,6 +85,7 @@ public:
NS_DECL_NSIDOMNAVIGATORGEOLOCATION
NS_DECL_NSIDOMNAVIGATORDESKTOPNOTIFICATION
NS_DECL_NSIDOMMOZNAVIGATORBATTERY
NS_DECL_NSIDOMMOZNAVIGATORSMS
static void Init();

View File

@ -2289,6 +2289,7 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMClientInformation)
DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsIDOMMozNavigatorBattery,
battery::BatteryManager::HasSupport())
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozNavigatorSms)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(Plugin, nsIDOMPlugin)

View File

@ -46,6 +46,8 @@ XPIDL_MODULE = dom_sms
include $(topsrcdir)/dom/dom-config.mk
XPIDLSRCS = \
nsIDOMNavigatorSms.idl \
nsIDOMSmsManager.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,45 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org.
*
* The Initial Developer of the Original Code is Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mounir Lamouri <mounir.lamouri@mozilla.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface nsIDOMMozSmsManager;
[scriptable, uuid(7752e51c-68ba-48c7-9fb6-32e5fbdb4599)]
interface nsIDOMMozNavigatorSms : nsISupports
{
readonly attribute nsIDOMMozSmsManager mozSms;
};

View File

@ -0,0 +1,42 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org.
*
* The Initial Developer of the Original Code is Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mounir Lamouri <mounir.lamouri@mozilla.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
[scriptable, function, uuid(562eade6-6dee-4c0a-bee9-bfc7f2bcadbe)]
interface nsIDOMMozSmsManager : nsISupports
{
};

View File

@ -49,13 +49,14 @@ DIRS = \
include $(topsrcdir)/config/rules.mk
_TEST_FILES = \
test_sms_basics.html \
$(NULL)
_CHROME_TEST_FILES = \
$(NULL)
#libs:: $(_TEST_FILES)
# $(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
libs:: $(_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
#libs:: $(_CHROME_TEST_FILES)
# $(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)

View File

@ -0,0 +1,30 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for WebSMS</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for WebSMS **/
function checkInterface(aInterface) {
ok(!(aInterface in window), aInterface + " should be prefixed");
ok(("Moz" + aInterface) in window, aInterface + " should be prefixed");
}
ok('mozSms' in navigator, "navigator.mozSms should exist");
checkInterface("SmsManager");
checkInterface("NavigatorSms");
</script>
</pre>
</body>
</html>

View File

@ -93,6 +93,7 @@ SHARED_LIBRARY_LIBS = \
$(DEPTH)/view/src/$(LIB_PREFIX)gkview_s.$(LIB_SUFFIX) \
$(DEPTH)/dom/base/$(LIB_PREFIX)jsdombase_s.$(LIB_SUFFIX) \
$(DEPTH)/dom/battery/$(LIB_PREFIX)dom_battery_s.$(LIB_SUFFIX) \
$(DEPTH)/dom/sms/src/$(LIB_PREFIX)dom_sms_s.$(LIB_SUFFIX) \
$(DEPTH)/dom/src/events/$(LIB_PREFIX)jsdomevents_s.$(LIB_SUFFIX) \
$(DEPTH)/dom/src/json/$(LIB_PREFIX)json_s.$(LIB_SUFFIX) \
$(DEPTH)/dom/src/jsurl/$(LIB_PREFIX)jsurl_s.$(LIB_SUFFIX) \

View File

@ -164,6 +164,7 @@
@BINPATH@/components/dom_range.xpt
@BINPATH@/components/dom_sidebar.xpt
@BINPATH@/components/dom_storage.xpt
@BINPATH@/components/dom_sms.xpt
@BINPATH@/components/dom_stylesheets.xpt
@BINPATH@/components/dom_threads.xpt
@BINPATH@/components/dom_traversal.xpt