From bc905fd7807cf95e6cdd910bb30e8963a2bc04a9 Mon Sep 17 00:00:00 2001 From: Mounir Lamouri Date: Sun, 20 Nov 2011 22:08:33 +0100 Subject: [PATCH] Bug 674725 - Part B - Add .mozSms to navigator. r=smaug --- browser/installer/package-manifest.in | 1 + dom/base/Navigator.cpp | 13 +++++++ dom/base/Navigator.h | 5 ++- dom/base/nsDOMClassInfo.cpp | 1 + dom/sms/interfaces/Makefile.in | 2 + dom/sms/interfaces/nsIDOMNavigatorSms.idl | 45 +++++++++++++++++++++++ dom/sms/interfaces/nsIDOMSmsManager.idl | 42 +++++++++++++++++++++ dom/sms/tests/Makefile.in | 5 ++- dom/sms/tests/test_sms_basics.html | 30 +++++++++++++++ layout/build/Makefile.in | 1 + mobile/xul/installer/package-manifest.in | 1 + 11 files changed, 143 insertions(+), 3 deletions(-) create mode 100644 dom/sms/interfaces/nsIDOMNavigatorSms.idl create mode 100644 dom/sms/interfaces/nsIDOMSmsManager.idl create mode 100644 dom/sms/tests/test_sms_basics.html diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in index 11334bfaaa9..5f18e2d85d6 100644 --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -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 diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp index 659bacd55f2..1d3f41bfa36 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -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 { diff --git a/dom/base/Navigator.h b/dom/base/Navigator.h index 32e561b91ab..b17f0b0ceb9 100644 --- a/dom/base/Navigator.h +++ b/dom/base/Navigator.h @@ -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(); diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index 3be0597396d..0ad892c2800 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -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) diff --git a/dom/sms/interfaces/Makefile.in b/dom/sms/interfaces/Makefile.in index 546f4860a22..f3002ed3e6d 100644 --- a/dom/sms/interfaces/Makefile.in +++ b/dom/sms/interfaces/Makefile.in @@ -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 diff --git a/dom/sms/interfaces/nsIDOMNavigatorSms.idl b/dom/sms/interfaces/nsIDOMNavigatorSms.idl new file mode 100644 index 00000000000..8d598f0ef7c --- /dev/null +++ b/dom/sms/interfaces/nsIDOMNavigatorSms.idl @@ -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 (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; +}; diff --git a/dom/sms/interfaces/nsIDOMSmsManager.idl b/dom/sms/interfaces/nsIDOMSmsManager.idl new file mode 100644 index 00000000000..6825862b7cf --- /dev/null +++ b/dom/sms/interfaces/nsIDOMSmsManager.idl @@ -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 (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 +{ +}; diff --git a/dom/sms/tests/Makefile.in b/dom/sms/tests/Makefile.in index dd244f22315..559b54b868d 100644 --- a/dom/sms/tests/Makefile.in +++ b/dom/sms/tests/Makefile.in @@ -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) diff --git a/dom/sms/tests/test_sms_basics.html b/dom/sms/tests/test_sms_basics.html new file mode 100644 index 00000000000..f5eeb03411b --- /dev/null +++ b/dom/sms/tests/test_sms_basics.html @@ -0,0 +1,30 @@ + + + + Test for WebSMS + + + + +

+ +
+
+
+ + diff --git a/layout/build/Makefile.in b/layout/build/Makefile.in index 677ee19ac8a..85d72344c6c 100644 --- a/layout/build/Makefile.in +++ b/layout/build/Makefile.in @@ -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) \ diff --git a/mobile/xul/installer/package-manifest.in b/mobile/xul/installer/package-manifest.in index 36f73ddf081..b7b45aba7a1 100644 --- a/mobile/xul/installer/package-manifest.in +++ b/mobile/xul/installer/package-manifest.in @@ -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