Merge draft
authorGregor Wagner <anygregor@gmail.com>
Wed, 10 Sep 2014 11:40:45 -0700
changeset 388165 03927f01def92e9acb4991e614ae3ea6e082f7f2
parent 204517 843332cc69af032ce66e591e7ab5271b24e6a0e8 (current diff)
parent 388164 61f604af129ecfc8d5b4657e931b220767b885f2 (diff)
child 388167 2cfa73ddd6e168f9ba846ea4173e9fc9c8297673
push id23132
push userbmo:lissyx+mozillians@lissyx.dyndns.org
push dateFri, 15 Jul 2016 10:07:12 +0000
milestone35.0a1
Merge
b2g/app/b2g.js
b2g/confvars.sh
configure.in
dom/asmjscache/AsmJSCache.cpp
dom/base/Navigator.cpp
dom/base/Navigator.h
dom/downloads/DownloadsAPI.js
dom/ipc/TabChild.cpp
dom/settings/SettingsManager.js
dom/settings/SettingsService.js
dom/settings/moz.build
dom/settings/tests/mochitest.ini
dom/tests/mochitest/general/test_interfaces.html
gfx/layers/GrallocImages.cpp
gfx/layers/opengl/CompositorOGL.cpp
js/src/gc/GCRuntime.h
js/src/jsgc.cpp
js/src/jsgc.h
js/src/vm/ForkJoin.cpp
js/src/vm/HelperThreads.cpp
js/src/vm/HelperThreads.h
js/src/vm/Runtime.cpp
js/src/vm/Runtime.h
testing/mozbase/mozrunner/mozrunner/base/device.py
widget/gonk/HwcComposer2D.cpp
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -1569,16 +1569,33 @@ TabChild::ActorDestroy(ActorDestroyReaso
 TabChild::~TabChild()
 {
     DestroyWindow();
 
     nsCOMPtr<nsIWebBrowser> webBrowser = do_QueryInterface(WebNavigation());
     if (webBrowser) {
       webBrowser->SetContainerWindow(nullptr);
     }
+
+    for (uint32_t index = 0, count = mCachedFileDescriptorInfos.Length();
+         index < count;
+         index++) {
+        nsAutoPtr<CachedFileDescriptorInfo>& info =
+            mCachedFileDescriptorInfos[index];
+
+        MOZ_ASSERT(!info->mCallback);
+
+        if (info->mFileDescriptor.IsValid()) {
+            MOZ_ASSERT(!info->mCanceled);
+
+            nsRefPtr<CloseFileRunnable> runnable =
+                new CloseFileRunnable(info->mFileDescriptor);
+            runnable->Dispatch();
+        }
+    }
 }
 
 void
 TabChild::SetProcessNameToAppName()
 {
   nsCOMPtr<mozIApplication> app = GetOwnApp();
   if (!app) {
     return;
new file mode 100644
--- /dev/null
+++ b/dom/mobilemessage/src/SmsFilter.cpp
@@ -0,0 +1,292 @@
+/* -*- 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 "SmsFilter.h"
+#include "jsapi.h"
+#include "jsfriendapi.h" // For js_DateGetMsecSinceEpoch.
+#include "js/Utility.h"
+#include "mozilla/dom/mobilemessage/Constants.h" // For MessageType
+#include "mozilla/dom/ToJSValue.h"
+#include "nsDOMString.h"
+#include "nsError.h"
+#include "nsIDOMClassInfo.h"
+#include "nsJSUtils.h"
+
+using namespace mozilla::dom::mobilemessage;
+
+DOMCI_DATA(MozSmsFilter, mozilla::dom::SmsFilter)
+
+namespace mozilla {
+namespace dom {
+
+NS_INTERFACE_MAP_BEGIN(SmsFilter)
+  NS_INTERFACE_MAP_ENTRY(nsIDOMMozSmsFilter)
+  NS_INTERFACE_MAP_ENTRY(nsISupports)
+  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozSmsFilter)
+NS_INTERFACE_MAP_END
+
+NS_IMPL_ADDREF(SmsFilter)
+NS_IMPL_RELEASE(SmsFilter)
+
+SmsFilter::SmsFilter()
+{
+  mData.startDate() = 0;
+  mData.endDate() = 0;
+  mData.delivery() = eDeliveryState_Unknown;
+  mData.read() = eReadState_Unknown;
+  mData.threadId() = 0;
+}
+
+SmsFilter::SmsFilter(const SmsFilterData& aData)
+  : mData(aData)
+{
+}
+
+/* static */ nsresult
+SmsFilter::NewSmsFilter(nsISupports** aSmsFilter)
+{
+  NS_ADDREF(*aSmsFilter = new SmsFilter());
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+SmsFilter::GetStartDate(JSContext* aCx, JS::MutableHandle<JS::Value> aStartDate)
+{
+  if (mData.startDate() == 0) {
+    aStartDate.setNull();
+    return NS_OK;
+  }
+
+  aStartDate.setObjectOrNull(JS_NewDateObjectMsec(aCx, mData.startDate()));
+  NS_ENSURE_TRUE(aStartDate.isObject(), NS_ERROR_FAILURE);
+
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+SmsFilter::SetStartDate(JSContext* aCx, JS::Handle<JS::Value> aStartDate)
+{
+  if (aStartDate.isNull()) {
+    mData.startDate() = 0;
+    return NS_OK;
+  }
+
+  if (!aStartDate.isObject()) {
+    return NS_ERROR_INVALID_ARG;
+  }
+
+  JS::Rooted<JSObject*> obj(aCx, &aStartDate.toObject());
+  if (!JS_ObjectIsDate(aCx, obj)) {
+    return NS_ERROR_INVALID_ARG;
+  }
+
+  mData.startDate() = js_DateGetMsecSinceEpoch(obj);
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+SmsFilter::GetEndDate(JSContext* aCx, JS::MutableHandle<JS::Value> aEndDate)
+{
+  if (mData.endDate() == 0) {
+    aEndDate.setNull();
+    return NS_OK;
+  }
+
+  aEndDate.setObjectOrNull(JS_NewDateObjectMsec(aCx, mData.endDate()));
+  NS_ENSURE_TRUE(aEndDate.isObject(), NS_ERROR_FAILURE);
+
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+SmsFilter::SetEndDate(JSContext* aCx, JS::Handle<JS::Value> aEndDate)
+{
+  if (aEndDate.isNull()) {
+    mData.endDate() = 0;
+    return NS_OK;
+  }
+
+  if (!aEndDate.isObject()) {
+    return NS_ERROR_INVALID_ARG;
+  }
+
+  JS::Rooted<JSObject*> obj(aCx, &aEndDate.toObject());
+  if (!JS_ObjectIsDate(aCx, obj)) {
+    return NS_ERROR_INVALID_ARG;
+  }
+
+  mData.endDate() = js_DateGetMsecSinceEpoch(obj);
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+SmsFilter::GetNumbers(JSContext* aCx, JS::MutableHandle<JS::Value> aNumbers)
+{
+  uint32_t length = mData.numbers().Length();
+
+  if (length == 0) {
+    aNumbers.setNull();
+    return NS_OK;
+  }
+
+  if (!ToJSValue(aCx, mData.numbers(), aNumbers)) {
+    return NS_ERROR_FAILURE;
+  }
+
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+SmsFilter::SetNumbers(JSContext* aCx, JS::Handle<JS::Value> aNumbers)
+{
+  if (aNumbers.isNull()) {
+    mData.numbers().Clear();
+    return NS_OK;
+  }
+
+  if (!aNumbers.isObject()) {
+    return NS_ERROR_INVALID_ARG;
+  }
+
+  JS::Rooted<JSObject*> obj(aCx, &aNumbers.toObject());
+  if (!JS_IsArrayObject(aCx, obj)) {
+    return NS_ERROR_INVALID_ARG;
+  }
+
+  uint32_t size;
+  MOZ_ALWAYS_TRUE(JS_GetArrayLength(aCx, obj, &size));
+
+  nsTArray<nsString> numbers;
+
+  for (uint32_t i=0; i<size; ++i) {
+    JS::Rooted<JS::Value> jsNumber(aCx);
+    if (!JS_GetElement(aCx, obj, i, &jsNumber)) {
+      return NS_ERROR_INVALID_ARG;
+    }
+
+    if (!jsNumber.isString()) {
+      return NS_ERROR_INVALID_ARG;
+    }
+
+    nsAutoJSString number;
+    if (!number.init(aCx, jsNumber.toString())) {
+      return NS_ERROR_FAILURE;
+    }
+
+    numbers.AppendElement(number);
+  }
+
+  mData.numbers().Clear();
+  mData.numbers().AppendElements(numbers);
+
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+SmsFilter::GetDelivery(nsAString& aDelivery)
+{
+  switch (mData.delivery()) {
+    case eDeliveryState_Received:
+      aDelivery = DELIVERY_RECEIVED;
+      break;
+    case eDeliveryState_Sent:
+      aDelivery = DELIVERY_SENT;
+      break;
+    case eDeliveryState_Unknown:
+      SetDOMStringToNull(aDelivery);
+      break;
+    default:
+      NS_ASSERTION(false, "We shouldn't get another delivery state!");
+      return NS_ERROR_UNEXPECTED;
+  }
+
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+SmsFilter::SetDelivery(const nsAString& aDelivery)
+{
+  if (aDelivery.IsEmpty()) {
+    mData.delivery() = eDeliveryState_Unknown;
+    return NS_OK;
+  }
+
+  if (aDelivery.Equals(DELIVERY_RECEIVED)) {
+    mData.delivery() = eDeliveryState_Received;
+    return NS_OK;
+  }
+
+  if (aDelivery.Equals(DELIVERY_SENT)) {
+    mData.delivery() = eDeliveryState_Sent;
+    return NS_OK;
+  }
+
+  return NS_ERROR_INVALID_ARG;
+}
+
+NS_IMETHODIMP
+SmsFilter::GetRead(JSContext* aCx, JS::MutableHandle<JS::Value> aRead)
+{
+  if (mData.read() == eReadState_Unknown) {
+    aRead.setNull();
+    return NS_OK;
+  }
+
+  aRead.setBoolean(mData.read());
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+SmsFilter::SetRead(JSContext* aCx, JS::Handle<JS::Value> aRead)
+{
+  if (aRead.isNull()) {
+    mData.read() = eReadState_Unknown;
+    return NS_OK;
+  }
+
+  if (!aRead.isBoolean()) {
+    return NS_ERROR_INVALID_ARG;
+  }
+
+  mData.read() = aRead.toBoolean() ? eReadState_Read : eReadState_Unread;
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+SmsFilter::GetThreadId(JSContext* aCx, JS::MutableHandle<JS::Value> aThreadId)
+{
+  if (!mData.threadId()) {
+    aThreadId.setNull();
+    return NS_OK;
+  }
+
+  aThreadId.setNumber(static_cast<double>(mData.threadId()));
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+SmsFilter::SetThreadId(JSContext* aCx, JS::Handle<JS::Value> aThreadId)
+{
+  if (aThreadId.isNull()) {
+    mData.threadId() = 0;
+    return NS_OK;
+  }
+
+  if (!aThreadId.isNumber()) {
+    return NS_ERROR_INVALID_ARG;
+  }
+
+  double number = aThreadId.toNumber();
+  uint64_t integer = static_cast<uint64_t>(number);
+  if (integer == 0 || integer != number) {
+    return NS_ERROR_INVALID_ARG;
+  }
+  mData.threadId() = integer;
+
+  return NS_OK;
+}
+
+} // namespace dom
+} // namespace mozilla
new file mode 100644
--- /dev/null
+++ b/dom/mobilemessage/src/SmsFilter.h
@@ -0,0 +1,43 @@
+/* -*- 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_SmsFilter_h
+#define mozilla_dom_mobilemessage_SmsFilter_h
+
+#include "mozilla/dom/mobilemessage/SmsTypes.h"
+#include "nsIDOMSmsFilter.h"
+#include "mozilla/Attributes.h"
+
+namespace mozilla {
+namespace dom {
+
+class SmsFilter MOZ_FINAL : public nsIDOMMozSmsFilter
+{
+public:
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSIDOMMOZSMSFILTER
+
+  SmsFilter();
+  SmsFilter(const mobilemessage::SmsFilterData& aData);
+
+  const mobilemessage::SmsFilterData& GetData() const;
+
+  static nsresult NewSmsFilter(nsISupports** aSmsFilter);
+
+private:
+  ~SmsFilter() {}
+
+  mobilemessage::SmsFilterData mData;
+};
+
+inline const mobilemessage::SmsFilterData&
+SmsFilter::GetData() const {
+  return mData;
+}
+
+} // namespace dom
+} // namespace mozilla
+
+#endif // mozilla_dom_mobilemessage_SmsFilter_h
--- a/dom/settings/moz.build
+++ b/dom/settings/moz.build
@@ -4,17 +4,17 @@
 # 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/.
 
 EXTRA_COMPONENTS += [
     'SettingsManager.js',
     'SettingsManager.manifest',
 ]
 
-if CONFIG['MOZ_B2G']:
+if CONFIG['MOZ_B2G'] or CONFIG['ENABLE_TESTS']:
     EXTRA_COMPONENTS += [
         'SettingsService.js',
         'SettingsService.manifest',
     ]
 
     MOCHITEST_CHROME_MANIFESTS += ['tests/chrome.ini']
 
 EXTRA_JS_MODULES += [
--- a/dom/settings/tests/mochitest.ini
+++ b/dom/settings/tests/mochitest.ini
@@ -1,10 +1,9 @@
 [DEFAULT]
-skip-if = (toolkit == 'gonk' && debug) || e10s #debug-only failure, bug 932878
 
 [test_settings_basics.html]
 [test_settings_permissions.html]
 [test_settings_blobs.html]
 [test_settings_data_uris.html]
 [test_settings_events.html]
 [test_settings_navigator_object.html]
 [test_settings_onsettingchange.html]
--- a/dom/telephony/ipc/TelephonyChild.cpp
+++ b/dom/telephony/ipc/TelephonyChild.cpp
@@ -15,16 +15,17 @@ USING_TELEPHONY_NAMESPACE
 TelephonyChild::TelephonyChild(TelephonyIPCService* aService)
   : mService(aService)
 {
   MOZ_ASSERT(aService);
 }
 
 TelephonyChild::~TelephonyChild()
 {
+
 }
 
 void
 TelephonyChild::ActorDestroy(ActorDestroyReason aWhy)
 {
   if (mService) {
     mService->NoteActorDestroyed();
     mService = nullptr;
--- a/dom/telephony/ipc/TelephonyIPCService.cpp
+++ b/dom/telephony/ipc/TelephonyIPCService.cpp
@@ -98,16 +98,21 @@ TelephonyIPCService::GetDefaultServiceId
   *aServiceId = mDefaultServiceId;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 TelephonyIPCService::RegisterListener(nsITelephonyListener *aListener)
 {
   MOZ_ASSERT(!mListeners.Contains(aListener));
+  
+  if (!mPTelephonyChild) {
+    NS_WARNING("TelephonyProvider used after shutdown has begun!");
+    return NS_ERROR_FAILURE;
+  }
 
   if (!mPTelephonyChild) {
     NS_WARNING("TelephonyService used after shutdown has begun!");
     return NS_ERROR_FAILURE;
   }
 
   // nsTArray doesn't fail.
   mListeners.AppendElement(aListener);
new file mode 100644
--- /dev/null
+++ b/testing/mozbase/mozb2g/setup.py
@@ -0,0 +1,25 @@
+# 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/.
+
+from setuptools import setup
+
+PACKAGE_VERSION = '0.3'
+
+deps = ['mozdevice >= 0.16', 'marionette_client >= 0.5.2']
+
+setup(name='mozb2g',
+      version=PACKAGE_VERSION,
+      description="B2G specific code for device automation",
+      long_description="see http://mozbase.readthedocs.org/",
+      classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
+      keywords='',
+      author='Mozilla Automation and Testing Team',
+      author_email='tools@lists.mozilla.org',
+      url='https://wiki.mozilla.org/Auto-tools/Projects/Mozbase',
+      license='MPL',
+      packages=['mozb2g'],
+      include_package_data=True,
+      zip_safe=False,
+      install_requires=deps
+      )
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..24f06bcd5e3a7515bf82fa84fe30b61f21021d75
GIT binary patch
literal 293
zc%17D@N?(olHy`uVBq!ia0vp^Ahrkx8<5=cZcP}FVk{1FcVbv~PUa<$!<OXj?!xdN
z1Q+aGJ{c&&S>O>_4Ag!dgc+SQW>)|O*-JcqUD@xj@pG#h>?xVE0w}c9)5S4F<NVZ1
zwtP(v0uB$wlbBRld)qgdv-m#vx7K{a^|^mFC8a&tn0Nnpr9XM@NvEA+7NM+H7^hdx
zlUFV2H*^cVsv96J^5wSNEGLdd%g%c4KXFLPg1Od9^OYOJRU^%%Q%cku*d*Q@{{A4;
zWscaYAB))}yn^2vC375n{-9`{n8e=idhFrs<>&SmU3e7da?dj3V@Bc2!}q4KT7D>0
h53QBkS<L={Q7pkVaWDUsH$Vq7c)I$ztaD0e0stdoYDNG6