diff --git a/b2g/app/b2g.js b/b2g/app/b2g.js index a82c4721db5e..b22521f14a9d 100644 --- a/b2g/app/b2g.js +++ b/b2g/app/b2g.js @@ -549,7 +549,14 @@ pref("app.update.staging.enabled", true); pref("app.update.service.enabled", true); // The URL hosting the update manifest. +// Temporary hack to only put Flame builds on aus4. 18 is Jelly Bean (4.3). +// This needs to be changed if Flame upgrades to 19 (Kit Kat) before other devices +// move to aus4. +#if ANDROID_VERSION == 18 +pref("app.update.url", "https://aus4.mozilla.org/update/3/%PRODUCT%/%VERSION%/%BUILD_ID%/%PRODUCT_DEVICE%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/update.xml"); +#else pref("app.update.url", "http://update.boot2gecko.org/%CHANNEL%/update.xml"); +#endif pref("app.update.channel", "@MOZ_UPDATE_CHANNEL@"); // Interval at which update manifest is fetched. In units of seconds. diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index f07ee6a621c2..4ede43f23b60 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,13 +19,13 @@ - - + + - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index be66be1b6df7..a31b4f1dfb05 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,10 +17,10 @@ - - + + - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index f6a2358dd4a1..012bbaecdb8c 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,14 +15,15 @@ - + - + + - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index f07ee6a621c2..4ede43f23b60 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,13 +19,13 @@ - - + + - + diff --git a/b2g/config/flame/config.json b/b2g/config/flame/config.json index e564646e2d6b..d50a16991278 100644 --- a/b2g/config/flame/config.json +++ b/b2g/config/flame/config.json @@ -27,7 +27,8 @@ "env": { "VARIANT": "user", "MOZILLA_OFFICIAL": "1", - "MOZ_TELEMETRY_REPORTING": "1" + "MOZ_TELEMETRY_REPORTING": "1", + "B2G_UPDATE_CHANNEL": "nightly" }, "b2g_manifest": "flame.xml", "b2g_manifest_branch": "master", diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index ef3a821105ce..dc92f18aa7fd 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,10 +17,10 @@ - - + + - + diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index bc7697b7d5f2..1cf86ff9b585 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "f2274c0c94a989a204b03b693c73ed1414b0f543", + "revision": "debbe27e7bc38406aa50fdbcac1a5dc670959222", "repo_path": "/integration/gaia-central" } diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index b5c9aa45bdd7..70ccb91a5601 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,12 +17,12 @@ - - + + - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 6f87617b2bb9..25d4ce0a28dd 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,8 +15,8 @@ - - + + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index f82d4bf3ce9f..8f740ed8e7a4 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -19,12 +19,12 @@ - - + + - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index efb24520ad23..733bb2a19440 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -17,12 +17,12 @@ - - + + - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index 8ece874e7c09..cd8d1d8f2f58 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -17,10 +17,10 @@ - - + + - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 8ece874e7c09..cd8d1d8f2f58 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,10 +17,10 @@ - - + + - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 2348d867ac7c..709b1d891f8d 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,12 +17,12 @@ - - + + - + diff --git a/build/mobile/b2gautomation.py b/build/mobile/b2gautomation.py index c9e07df5b7b2..f78d56b6ab77 100644 --- a/build/mobile/b2gautomation.py +++ b/build/mobile/b2gautomation.py @@ -2,6 +2,7 @@ # 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/. +import datetime import mozcrash import threading import os @@ -9,6 +10,7 @@ import posixpath import Queue import re import shutil +import signal import tempfile import time import traceback @@ -152,6 +154,19 @@ class B2GRemoteAutomation(Automation): self.log.info("TEST-UNEXPECTED-FAIL | %s | application timed " "out after %d seconds with no output", self.lastTestSeen, int(timeout)) + self._devicemanager.killProcess('/system/b2g/b2g', sig=signal.SIGABRT) + + timeout = 10 # seconds + starttime = datetime.datetime.now() + while datetime.datetime.now() - starttime < datetime.timedelta(seconds=timeout): + if not self._devicemanager.processExist('/system/b2g/b2g'): + break + time.sleep(1) + else: + print "timed out after %d seconds waiting for b2g process to exit" % timeout + return 1 + + self.checkForCrashes(None, symbolsPath) return 1 def getDeviceStatus(self, serial=None): diff --git a/content/base/src/nsGkAtomList.h b/content/base/src/nsGkAtomList.h index b60df14a2bc2..37e63dd60bec 100644 --- a/content/base/src/nsGkAtomList.h +++ b/content/base/src/nsGkAtomList.h @@ -660,6 +660,7 @@ GK_ATOM(onanimationiteration, "onanimationiteration") GK_ATOM(onanimationstart, "onanimationstart") GK_ATOM(onantennaavailablechange, "onantennaavailablechange") GK_ATOM(onAppCommand, "onAppCommand") +GK_ATOM(onattributechanged, "onattributechanged") GK_ATOM(onaudioprocess, "onaudioprocess") GK_ATOM(onbeforecopy, "onbeforecopy") GK_ATOM(onbeforecut, "onbeforecut") diff --git a/dom/apps/src/InterAppCommService.jsm b/dom/apps/src/InterAppCommService.jsm index c460f7e80c25..55ad477d8d6b 100644 --- a/dom/apps/src/InterAppCommService.jsm +++ b/dom/apps/src/InterAppCommService.jsm @@ -465,6 +465,67 @@ this.InterAppCommService = { oid: aOuterWindowID, requestID: aRequestID }); }, + /** + * Fetch the subscribers that are currently allowed to connect. + * + * @param aKeyword The connection's keyword. + * @param aPubAppManifestURL The manifest URL of the publisher. + * + * @param return an array of manifest URLs of the subscribers. + */ + _getAllowedSubAppManifestURLs: function(aKeyword, aPubAppManifestURL) { + let allowedPubAppManifestURLs = this._allowedConnections[aKeyword]; + if (!allowedPubAppManifestURLs) { + return []; + } + + let allowedSubAppManifestURLs = + allowedPubAppManifestURLs[aPubAppManifestURL]; + if (!allowedSubAppManifestURLs) { + return []; + } + + return allowedSubAppManifestURLs; + }, + + /** + * Add the newly selected apps into the allowed connections and return the + * aggregated allowed connections. + * + * @param aKeyword The connection's keyword. + * @param aPubAppManifestURL The manifest URL of the publisher. + * @param aSelectedApps An array of the subscribers' information. + * + * @param return an array of manifest URLs of the subscribers. + */ + _addSelectedApps: function(aKeyword, aPubAppManifestURL, aSelectedApps) { + let allowedPubAppManifestURLs = this._allowedConnections[aKeyword]; + + // Add a new entry for |aKeyword|. + if (!allowedPubAppManifestURLs) { + allowedPubAppManifestURLs = this._allowedConnections[aKeyword] = {}; + } + + let allowedSubAppManifestURLs = + allowedPubAppManifestURLs[aPubAppManifestURL]; + + // Add a new entry for |aPubAppManifestURL|. + if (!allowedSubAppManifestURLs) { + allowedSubAppManifestURLs = + allowedPubAppManifestURLs[aPubAppManifestURL] = []; + } + + // Add the selected apps into the existing set of allowed connections. + aSelectedApps.forEach(function(aSelectedApp) { + let allowedSubAppManifestURL = aSelectedApp.manifestURL; + if (allowedSubAppManifestURLs.indexOf(allowedSubAppManifestURL) == -1) { + allowedSubAppManifestURLs.push(allowedSubAppManifestURL); + } + }); + + return allowedSubAppManifestURLs; + }, + _connect: function(aMessage, aTarget) { let keyword = aMessage.keyword; let pubRules = aMessage.rules; @@ -482,15 +543,11 @@ this.InterAppCommService = { return; } - // Fetch the apps that used to be allowed to connect before, so that - // users don't need to select/allow them again. That is, we only pop up - // the prompt UI for the *new* connections. - let allowedSubAppManifestURLs = []; - let allowedPubAppManifestURLs = this._allowedConnections[keyword]; - if (allowedPubAppManifestURLs && - allowedPubAppManifestURLs[pubAppManifestURL]) { - allowedSubAppManifestURLs = allowedPubAppManifestURLs[pubAppManifestURL]; - } + // Fetch the apps that are currently allowed to connect, so that users + // don't need to select/allow them again, which means we only pop up the + // prompt UI for the *new* connections. + let allowedSubAppManifestURLs = + this._getAllowedSubAppManifestURLs(keyword, pubAppManifestURL); // Check rules to see if a subscribed app is allowed to connect. let appsToSelect = []; @@ -799,38 +856,31 @@ this.InterAppCommService = { let requestID = caller.requestID; let target = caller.target; - let manifestURL = aData.manifestURL; + let pubAppManifestURL = aData.manifestURL; let keyword = aData.keyword; let selectedApps = aData.selectedApps; + let allowedSubAppManifestURLs; if (selectedApps.length == 0) { - if (DEBUG) debug("No apps are selected to connect.") - this._dispatchMessagePorts(keyword, manifestURL, [], - target, outerWindowID, requestID); - return; - } + // Only do the connections for the existing allowed subscribers because + // no new apps are selected to connect. + if (DEBUG) debug("No new apps are selected to connect.") - // Find the entry of allowed connections to add the selected apps. - let allowedPubAppManifestURLs = this._allowedConnections[keyword]; - if (!allowedPubAppManifestURLs) { - allowedPubAppManifestURLs = this._allowedConnections[keyword] = {}; - } - let allowedSubAppManifestURLs = allowedPubAppManifestURLs[manifestURL]; - if (!allowedSubAppManifestURLs) { - allowedSubAppManifestURLs = allowedPubAppManifestURLs[manifestURL] = []; - } + allowedSubAppManifestURLs = + this._getAllowedSubAppManifestURLs(keyword, pubAppManifestURL); + } else { + // Do connections for for the existing allowed subscribers and the newly + // selected subscribers. + if (DEBUG) debug("Some new apps are selected to connect.") - // Add the selected app into the existing set of allowed connections. - selectedApps.forEach(function(aSelectedApp) { - let allowedSubAppManifestURL = aSelectedApp.manifestURL; - if (allowedSubAppManifestURLs.indexOf(allowedSubAppManifestURL) == -1) { - allowedSubAppManifestURLs.push(allowedSubAppManifestURL); - } - }); + allowedSubAppManifestURLs = + this._addSelectedApps(keyword, pubAppManifestURL, selectedApps); + } // Finally, dispatch the message ports for the allowed connections, // including the old connections and the newly selected connection. - this._dispatchMessagePorts(keyword, manifestURL, allowedSubAppManifestURLs, + this._dispatchMessagePorts(keyword, pubAppManifestURL, + allowedSubAppManifestURLs, target, outerWindowID, requestID); }, diff --git a/dom/bluetooth2/BluetoothAdapter.cpp b/dom/bluetooth2/BluetoothAdapter.cpp index d4d235859466..f094473aa3f3 100644 --- a/dom/bluetooth2/BluetoothAdapter.cpp +++ b/dom/bluetooth2/BluetoothAdapter.cpp @@ -169,6 +169,7 @@ BluetoothAdapter::BluetoothAdapter(nsPIDOMWindow* aWindow, , mPairable(false) , mPowered(false) , mIsRooted(false) + , mState(BluetoothAdapterState::Disabled) { MOZ_ASSERT(aWindow); MOZ_ASSERT(IsDOMBinding()); @@ -669,6 +670,21 @@ BluetoothAdapter::SetPairingConfirmation(const nsAString& aDeviceAddress, return request.forget(); } +/* + * TODO: Implement Enable/Disable functions + */ +already_AddRefed +BluetoothAdapter::Enable() +{ + return nullptr; +} + +already_AddRefed +BluetoothAdapter::Disable() +{ + return nullptr; +} + already_AddRefed BluetoothAdapter::Connect(BluetoothDevice& aDevice, const Optional& aServiceUuid, diff --git a/dom/bluetooth2/BluetoothAdapter.h b/dom/bluetooth2/BluetoothAdapter.h index cea5a1f22a57..c3b6686cfdf8 100644 --- a/dom/bluetooth2/BluetoothAdapter.h +++ b/dom/bluetooth2/BluetoothAdapter.h @@ -9,6 +9,8 @@ #include "mozilla/Attributes.h" #include "mozilla/DOMEventTargetHelper.h" +#include "mozilla/dom/BluetoothAdapter2Binding.h" +#include "mozilla/dom/Promise.h" #include "BluetoothCommon.h" #include "BluetoothPropertyContainer.h" #include "nsCOMPtr.h" @@ -48,6 +50,11 @@ public: virtual void DisconnectFromOwner() MOZ_OVERRIDE; + BluetoothAdapterState State() const + { + return mState; + } + void GetAddress(nsString& aAddress) const { aAddress = mAddress; @@ -115,6 +122,11 @@ public: SetAuthorization(const nsAString& aDeviceAddress, bool aAllow, ErrorResult& aRv); + already_AddRefed + Enable(); + already_AddRefed + Disable(); + already_AddRefed Connect(BluetoothDevice& aDevice, const Optional& aServiceUuid, ErrorResult& aRv); @@ -153,6 +165,7 @@ public: IMPL_EVENT_HANDLER(pairedstatuschanged); IMPL_EVENT_HANDLER(requestmediaplaystatus); IMPL_EVENT_HANDLER(scostatuschanged); + IMPL_EVENT_HANDLER(attributechanged); nsPIDOMWindow* GetParentObject() const { @@ -175,6 +188,7 @@ private: JS::Heap mJsUuids; JS::Heap mJsDeviceAddresses; + BluetoothAdapterState mState; nsString mAddress; nsString mName; bool mDiscoverable; diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index 47de3841d9d3..3fe4a97ab31b 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -846,26 +846,26 @@ ContentChild::RecvSetProcessSandbox() // at some point; see bug 880808. #if defined(MOZ_CONTENT_SANDBOX) #if defined(XP_LINUX) - SetCurrentProcessSandbox(); + SetCurrentProcessSandbox(); #elif defined(XP_WIN) - mozilla::SandboxTarget::Instance()->StartSandbox(); + mozilla::SandboxTarget::Instance()->StartSandbox(); #endif #endif - return true; + return true; } bool ContentChild::RecvSpeakerManagerNotify() { #ifdef MOZ_WIDGET_GONK - nsRefPtr service = - SpeakerManagerService::GetSpeakerManagerService(); - if (service) { - service->Notify(); - } - return true; + nsRefPtr service = + SpeakerManagerService::GetSpeakerManagerService(); + if (service) { + service->Notify(); + } + return true; #endif - return false; + return false; } static CancelableTask* sFirstIdleTask; @@ -981,98 +981,98 @@ ContentChild::DeallocPBrowserChild(PBrowserChild* iframe) PBlobChild* ContentChild::AllocPBlobChild(const BlobConstructorParams& aParams) { - return BlobChild::Create(this, aParams); + return BlobChild::Create(this, aParams); } bool ContentChild::DeallocPBlobChild(PBlobChild* aActor) { - delete aActor; - return true; + delete aActor; + return true; } BlobChild* ContentChild::GetOrCreateActorForBlob(nsIDOMBlob* aBlob) { - MOZ_ASSERT(NS_IsMainThread()); - MOZ_ASSERT(aBlob); + MOZ_ASSERT(NS_IsMainThread()); + MOZ_ASSERT(aBlob); - // If the blob represents a remote blob then we can simply pass its actor back - // here. - if (nsCOMPtr remoteBlob = do_QueryInterface(aBlob)) { - BlobChild* actor = - static_cast( - static_cast(remoteBlob->GetPBlob())); - MOZ_ASSERT(actor); - return actor; - } + // If the blob represents a remote blob then we can simply pass its actor back + // here. + if (nsCOMPtr remoteBlob = do_QueryInterface(aBlob)) { + BlobChild* actor = + static_cast( + static_cast(remoteBlob->GetPBlob())); + MOZ_ASSERT(actor); + return actor; + } - // All blobs shared between processes must be immutable. - nsCOMPtr mutableBlob = do_QueryInterface(aBlob); - if (!mutableBlob || NS_FAILED(mutableBlob->SetMutable(false))) { - NS_WARNING("Failed to make blob immutable!"); - return nullptr; - } + // All blobs shared between processes must be immutable. + nsCOMPtr mutableBlob = do_QueryInterface(aBlob); + if (!mutableBlob || NS_FAILED(mutableBlob->SetMutable(false))) { + NS_WARNING("Failed to make blob immutable!"); + return nullptr; + } #ifdef DEBUG - { - // XXX This is only safe so long as all blob implementations in our tree - // inherit nsDOMFileBase. If that ever changes then this will need to - // grow a real interface or something. - const auto* blob = static_cast(aBlob); + { + // XXX This is only safe so long as all blob implementations in our tree + // inherit nsDOMFileBase. If that ever changes then this will need to + // grow a real interface or something. + const auto* blob = static_cast(aBlob); - MOZ_ASSERT(!blob->IsSizeUnknown()); - MOZ_ASSERT(!blob->IsDateUnknown()); - } + MOZ_ASSERT(!blob->IsSizeUnknown()); + MOZ_ASSERT(!blob->IsDateUnknown()); + } #endif - ParentBlobConstructorParams params; + ParentBlobConstructorParams params; - nsString contentType; - nsresult rv = aBlob->GetType(contentType); - NS_ENSURE_SUCCESS(rv, nullptr); - - uint64_t length; - rv = aBlob->GetSize(&length); - NS_ENSURE_SUCCESS(rv, nullptr); - - nsCOMPtr stream; - rv = aBlob->GetInternalStream(getter_AddRefs(stream)); - NS_ENSURE_SUCCESS(rv, nullptr); - - InputStreamParams inputStreamParams; - nsTArray fds; - SerializeInputStream(stream, inputStreamParams, fds); - - MOZ_ASSERT(fds.IsEmpty()); - - params.optionalInputStreamParams() = inputStreamParams; - - nsCOMPtr file = do_QueryInterface(aBlob); - if (file) { - FileBlobConstructorParams fileParams; - - rv = file->GetName(fileParams.name()); + nsString contentType; + nsresult rv = aBlob->GetType(contentType); NS_ENSURE_SUCCESS(rv, nullptr); - rv = file->GetMozLastModifiedDate(&fileParams.modDate()); + uint64_t length; + rv = aBlob->GetSize(&length); NS_ENSURE_SUCCESS(rv, nullptr); - fileParams.contentType() = contentType; - fileParams.length() = length; + nsCOMPtr stream; + rv = aBlob->GetInternalStream(getter_AddRefs(stream)); + NS_ENSURE_SUCCESS(rv, nullptr); - params.blobParams() = fileParams; - } else { - NormalBlobConstructorParams blobParams; - blobParams.contentType() = contentType; - blobParams.length() = length; - params.blobParams() = blobParams; - } + InputStreamParams inputStreamParams; + nsTArray fds; + SerializeInputStream(stream, inputStreamParams, fds); - BlobChild* actor = BlobChild::Create(this, aBlob); - NS_ENSURE_TRUE(actor, nullptr); + MOZ_ASSERT(fds.IsEmpty()); - return SendPBlobConstructor(actor, params) ? actor : nullptr; + params.optionalInputStreamParams() = inputStreamParams; + + nsCOMPtr file = do_QueryInterface(aBlob); + if (file) { + FileBlobConstructorParams fileParams; + + rv = file->GetName(fileParams.name()); + NS_ENSURE_SUCCESS(rv, nullptr); + + rv = file->GetMozLastModifiedDate(&fileParams.modDate()); + NS_ENSURE_SUCCESS(rv, nullptr); + + fileParams.contentType() = contentType; + fileParams.length() = length; + + params.blobParams() = fileParams; + } else { + NormalBlobConstructorParams blobParams; + blobParams.contentType() = contentType; + blobParams.length() = length; + params.blobParams() = blobParams; + } + + BlobChild* actor = BlobChild::Create(this, aBlob); + NS_ENSURE_TRUE(actor, nullptr); + + return SendPBlobConstructor(actor, params) ? actor : nullptr; } PCrashReporterChild* @@ -1109,15 +1109,15 @@ ContentChild::DeallocPHalChild(PHalChild* aHal) PIndexedDBChild* ContentChild::AllocPIndexedDBChild() { - NS_NOTREACHED("Should never get here!"); - return nullptr; + NS_NOTREACHED("Should never get here!"); + return nullptr; } bool ContentChild::DeallocPIndexedDBChild(PIndexedDBChild* aActor) { - delete aActor; - return true; + delete aActor; + return true; } asmjscache::PAsmJSCacheEntryChild* @@ -1126,15 +1126,15 @@ ContentChild::AllocPAsmJSCacheEntryChild( const asmjscache::WriteParams& aWriteParams, const IPC::Principal& aPrincipal) { - NS_NOTREACHED("Should never get here!"); - return nullptr; + NS_NOTREACHED("Should never get here!"); + return nullptr; } bool ContentChild::DeallocPAsmJSCacheEntryChild(PAsmJSCacheEntryChild* aActor) { - asmjscache::DeallocEntryChild(aActor); - return true; + asmjscache::DeallocEntryChild(aActor); + return true; } PTestShellChild* @@ -1357,12 +1357,12 @@ ContentChild::RecvRegisterChrome(const InfallibleTArray& packages bool ContentChild::RecvSetOffline(const bool& offline) { - nsCOMPtr io (do_GetIOService()); - NS_ASSERTION(io, "IO Service can not be null"); + nsCOMPtr io (do_GetIOService()); + NS_ASSERTION(io, "IO Service can not be null"); - io->SetOffline(offline); + io->SetOffline(offline); - return true; + return true; } void @@ -1443,15 +1443,15 @@ bool ContentChild::RecvSystemMemoryAvailable(const uint64_t& aGetterId, const uint32_t& aMemoryAvailable) { - nsRefPtr p = dont_AddRef(reinterpret_cast(aGetterId)); + nsRefPtr p = dont_AddRef(reinterpret_cast(aGetterId)); - if (!aMemoryAvailable) { - p->MaybeReject(NS_LITERAL_STRING("Abnormal")); + if (!aMemoryAvailable) { + p->MaybeReject(NS_LITERAL_STRING("Abnormal")); + return true; + } + + p->MaybeResolve((int)aMemoryAvailable); return true; - } - - p->MaybeResolve((int)aMemoryAvailable); - return true; } bool @@ -1489,7 +1489,7 @@ ContentChild::RecvNotifyVisited(const URIParams& aURI) } nsCOMPtr history = services::GetHistoryService(); if (history) { - history->NotifyVisited(newURI); + history->NotifyVisited(newURI); } return true; } @@ -1500,63 +1500,63 @@ ContentChild::RecvAsyncMessage(const nsString& aMsg, const InfallibleTArray& aCpows, const IPC::Principal& aPrincipal) { - nsRefPtr cpm = nsFrameMessageManager::sChildProcessManager; - if (cpm) { - StructuredCloneData cloneData = ipc::UnpackClonedMessageDataForChild(aData); - CpowIdHolder cpows(GetCPOWManager(), aCpows); - cpm->ReceiveMessage(static_cast(cpm.get()), - aMsg, false, &cloneData, &cpows, aPrincipal, nullptr); - } - return true; + nsRefPtr cpm = nsFrameMessageManager::sChildProcessManager; + if (cpm) { + StructuredCloneData cloneData = ipc::UnpackClonedMessageDataForChild(aData); + CpowIdHolder cpows(GetCPOWManager(), aCpows); + cpm->ReceiveMessage(static_cast(cpm.get()), + aMsg, false, &cloneData, &cpows, aPrincipal, nullptr); + } + return true; } bool ContentChild::RecvGeolocationUpdate(const GeoPosition& somewhere) { - nsCOMPtr gs = do_GetService("@mozilla.org/geolocation/service;1"); - if (!gs) { + nsCOMPtr gs = do_GetService("@mozilla.org/geolocation/service;1"); + if (!gs) { + return true; + } + nsCOMPtr position = somewhere; + gs->Update(position); return true; - } - nsCOMPtr position = somewhere; - gs->Update(position); - return true; } bool ContentChild::RecvAddPermission(const IPC::Permission& permission) { #if MOZ_PERMISSIONS - nsCOMPtr permissionManagerIface = - services::GetPermissionManager(); - nsPermissionManager* permissionManager = - static_cast(permissionManagerIface.get()); - NS_ABORT_IF_FALSE(permissionManager, - "We have no permissionManager in the Content process !"); + nsCOMPtr permissionManagerIface = + services::GetPermissionManager(); + nsPermissionManager* permissionManager = + static_cast(permissionManagerIface.get()); + NS_ABORT_IF_FALSE(permissionManager, + "We have no permissionManager in the Content process !"); - nsCOMPtr uri; - NS_NewURI(getter_AddRefs(uri), NS_LITERAL_CSTRING("http://") + nsCString(permission.host)); - NS_ENSURE_TRUE(uri, true); + nsCOMPtr uri; + NS_NewURI(getter_AddRefs(uri), NS_LITERAL_CSTRING("http://") + nsCString(permission.host)); + NS_ENSURE_TRUE(uri, true); - nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager(); - MOZ_ASSERT(secMan); + nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager(); + MOZ_ASSERT(secMan); - nsCOMPtr principal; - nsresult rv = secMan->GetAppCodebasePrincipal(uri, permission.appId, + nsCOMPtr principal; + nsresult rv = secMan->GetAppCodebasePrincipal(uri, permission.appId, permission.isInBrowserElement, getter_AddRefs(principal)); - NS_ENSURE_SUCCESS(rv, true); + NS_ENSURE_SUCCESS(rv, true); - permissionManager->AddInternal(principal, - nsCString(permission.type), - permission.capability, - 0, - permission.expireType, - permission.expireTime, - nsPermissionManager::eNotify, - nsPermissionManager::eNoDBOperation); + permissionManager->AddInternal(principal, + nsCString(permission.type), + permission.capability, + 0, + permission.expireType, + permission.expireTime, + nsPermissionManager::eNotify, + nsPermissionManager::eNoDBOperation); #endif - return true; + return true; } bool @@ -1567,7 +1567,7 @@ ContentChild::RecvScreenSizeChanged(const gfxIntSize& size) #else NS_RUNTIMEABORT("Message currently only expected on android"); #endif - return true; + return true; } bool @@ -1770,30 +1770,30 @@ ContentChild::RecvMinimizeMemoryUsage() bool ContentChild::RecvNotifyPhoneStateChange(const nsString& aState) { - nsCOMPtr os = services::GetObserverService(); - if (os) { - os->NotifyObservers(nullptr, "phone-state-changed", aState.get()); - } - return true; + nsCOMPtr os = services::GetObserverService(); + if (os) { + os->NotifyObservers(nullptr, "phone-state-changed", aState.get()); + } + return true; } void ContentChild::AddIdleObserver(nsIObserver* aObserver, uint32_t aIdleTimeInS) { - MOZ_ASSERT(aObserver, "null idle observer"); - // Make sure aObserver isn't released while we wait for the parent - aObserver->AddRef(); - SendAddIdleObserver(reinterpret_cast(aObserver), aIdleTimeInS); - mIdleObservers.PutEntry(aObserver); + MOZ_ASSERT(aObserver, "null idle observer"); + // Make sure aObserver isn't released while we wait for the parent + aObserver->AddRef(); + SendAddIdleObserver(reinterpret_cast(aObserver), aIdleTimeInS); + mIdleObservers.PutEntry(aObserver); } void ContentChild::RemoveIdleObserver(nsIObserver* aObserver, uint32_t aIdleTimeInS) { - MOZ_ASSERT(aObserver, "null idle observer"); - SendRemoveIdleObserver(reinterpret_cast(aObserver), aIdleTimeInS); - aObserver->Release(); - mIdleObservers.RemoveEntry(aObserver); + MOZ_ASSERT(aObserver, "null idle observer"); + SendRemoveIdleObserver(reinterpret_cast(aObserver), aIdleTimeInS); + aObserver->Release(); + mIdleObservers.RemoveEntry(aObserver); } bool @@ -1801,13 +1801,13 @@ ContentChild::RecvNotifyIdleObserver(const uint64_t& aObserver, const nsCString& aTopic, const nsString& aTimeStr) { - nsIObserver* observer = reinterpret_cast(aObserver); - if (mIdleObservers.Contains(observer)) { - observer->Observe(nullptr, aTopic.get(), aTimeStr.get()); - } else { - NS_WARNING("Received notification for an idle observer that was removed."); - } - return true; + nsIObserver* observer = reinterpret_cast(aObserver); + if (mIdleObservers.Contains(observer)) { + observer->Observe(nullptr, aTopic.get(), aTimeStr.get()); + } else { + NS_WARNING("Received notification for an idle observer that was removed."); + } + return true; } bool diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 6de82859766f..01115152302d 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -2441,126 +2441,126 @@ ContentParent::DeallocPBrowserParent(PBrowserParent* frame) PDeviceStorageRequestParent* ContentParent::AllocPDeviceStorageRequestParent(const DeviceStorageParams& aParams) { - nsRefPtr result = new DeviceStorageRequestParent(aParams); - if (!result->EnsureRequiredPermissions(this)) { - return nullptr; - } - result->Dispatch(); - return result.forget().take(); + nsRefPtr result = new DeviceStorageRequestParent(aParams); + if (!result->EnsureRequiredPermissions(this)) { + return nullptr; + } + result->Dispatch(); + return result.forget().take(); } bool ContentParent::DeallocPDeviceStorageRequestParent(PDeviceStorageRequestParent* doomed) { - DeviceStorageRequestParent *parent = static_cast(doomed); - NS_RELEASE(parent); - return true; + DeviceStorageRequestParent *parent = static_cast(doomed); + NS_RELEASE(parent); + return true; } PFileSystemRequestParent* ContentParent::AllocPFileSystemRequestParent(const FileSystemParams& aParams) { - nsRefPtr result = new FileSystemRequestParent(); - if (!result->Dispatch(this, aParams)) { - return nullptr; - } - return result.forget().take(); + nsRefPtr result = new FileSystemRequestParent(); + if (!result->Dispatch(this, aParams)) { + return nullptr; + } + return result.forget().take(); } bool ContentParent::DeallocPFileSystemRequestParent(PFileSystemRequestParent* doomed) { - FileSystemRequestParent* parent = static_cast(doomed); - NS_RELEASE(parent); - return true; + FileSystemRequestParent* parent = static_cast(doomed); + NS_RELEASE(parent); + return true; } PBlobParent* ContentParent::AllocPBlobParent(const BlobConstructorParams& aParams) { - return BlobParent::Create(this, aParams); + return BlobParent::Create(this, aParams); } bool ContentParent::DeallocPBlobParent(PBlobParent* aActor) { - delete aActor; - return true; + delete aActor; + return true; } BlobParent* ContentParent::GetOrCreateActorForBlob(nsIDOMBlob* aBlob) { - MOZ_ASSERT(NS_IsMainThread()); - MOZ_ASSERT(aBlob); + MOZ_ASSERT(NS_IsMainThread()); + MOZ_ASSERT(aBlob); - // If the blob represents a remote blob for this ContentParent then we can - // simply pass its actor back here. - if (nsCOMPtr remoteBlob = do_QueryInterface(aBlob)) { - if (BlobParent* actor = static_cast( - static_cast(remoteBlob->GetPBlob()))) { - if (static_cast(actor->Manager()) == this) { - return actor; - } + // If the blob represents a remote blob for this ContentParent then we can + // simply pass its actor back here. + if (nsCOMPtr remoteBlob = do_QueryInterface(aBlob)) { + if (BlobParent* actor = static_cast( + static_cast(remoteBlob->GetPBlob()))) { + if (static_cast(actor->Manager()) == this) { + return actor; + } + } } - } - // All blobs shared between processes must be immutable. - nsCOMPtr mutableBlob = do_QueryInterface(aBlob); - if (!mutableBlob || NS_FAILED(mutableBlob->SetMutable(false))) { - NS_WARNING("Failed to make blob immutable!"); - return nullptr; - } - - // XXX This is only safe so long as all blob implementations in our tree - // inherit nsDOMFileBase. If that ever changes then this will need to grow - // a real interface or something. - const auto* blob = static_cast(aBlob); - - ChildBlobConstructorParams params; - - if (blob->IsSizeUnknown() || blob->IsDateUnknown()) { - // We don't want to call GetSize or GetLastModifiedDate - // yet since that may stat a file on the main thread - // here. Instead we'll learn the size lazily from the - // other process. - params = MysteryBlobConstructorParams(); - } - else { - nsString contentType; - nsresult rv = aBlob->GetType(contentType); - NS_ENSURE_SUCCESS(rv, nullptr); - - uint64_t length; - rv = aBlob->GetSize(&length); - NS_ENSURE_SUCCESS(rv, nullptr); - - nsCOMPtr file = do_QueryInterface(aBlob); - if (file) { - FileBlobConstructorParams fileParams; - - rv = file->GetMozLastModifiedDate(&fileParams.modDate()); - NS_ENSURE_SUCCESS(rv, nullptr); - - rv = file->GetName(fileParams.name()); - NS_ENSURE_SUCCESS(rv, nullptr); - - fileParams.contentType() = contentType; - fileParams.length() = length; - - params = fileParams; - } else { - NormalBlobConstructorParams blobParams; - blobParams.contentType() = contentType; - blobParams.length() = length; - params = blobParams; + // All blobs shared between processes must be immutable. + nsCOMPtr mutableBlob = do_QueryInterface(aBlob); + if (!mutableBlob || NS_FAILED(mutableBlob->SetMutable(false))) { + NS_WARNING("Failed to make blob immutable!"); + return nullptr; } - } - BlobParent* actor = BlobParent::Create(this, aBlob); - NS_ENSURE_TRUE(actor, nullptr); + // XXX This is only safe so long as all blob implementations in our tree + // inherit nsDOMFileBase. If that ever changes then this will need to grow + // a real interface or something. + const auto* blob = static_cast(aBlob); - return SendPBlobConstructor(actor, params) ? actor : nullptr; + ChildBlobConstructorParams params; + + if (blob->IsSizeUnknown() || blob->IsDateUnknown()) { + // We don't want to call GetSize or GetLastModifiedDate + // yet since that may stat a file on the main thread + // here. Instead we'll learn the size lazily from the + // other process. + params = MysteryBlobConstructorParams(); + } + else { + nsString contentType; + nsresult rv = aBlob->GetType(contentType); + NS_ENSURE_SUCCESS(rv, nullptr); + + uint64_t length; + rv = aBlob->GetSize(&length); + NS_ENSURE_SUCCESS(rv, nullptr); + + nsCOMPtr file = do_QueryInterface(aBlob); + if (file) { + FileBlobConstructorParams fileParams; + + rv = file->GetMozLastModifiedDate(&fileParams.modDate()); + NS_ENSURE_SUCCESS(rv, nullptr); + + rv = file->GetName(fileParams.name()); + NS_ENSURE_SUCCESS(rv, nullptr); + + fileParams.contentType() = contentType; + fileParams.length() = length; + + params = fileParams; + } else { + NormalBlobConstructorParams blobParams; + blobParams.contentType() = contentType; + blobParams.length() = length; + params = blobParams; + } + } + + BlobParent* actor = BlobParent::Create(this, aBlob); + NS_ENSURE_TRUE(actor, nullptr); + + return SendPBlobConstructor(actor, params) ? actor : nullptr; } void @@ -2631,9 +2631,9 @@ ContentParent::AllocPCrashReporterParent(const NativeThreadId& tid, const uint32_t& processType) { #ifdef MOZ_CRASHREPORTER - return new CrashReporterParent(); + return new CrashReporterParent(); #else - return nullptr; + return nullptr; #endif } @@ -2642,15 +2642,15 @@ ContentParent::RecvPCrashReporterConstructor(PCrashReporterParent* actor, const NativeThreadId& tid, const uint32_t& processType) { - static_cast(actor)->SetChildData(tid, processType); - return true; + static_cast(actor)->SetChildData(tid, processType); + return true; } bool ContentParent::DeallocPCrashReporterParent(PCrashReporterParent* crashreporter) { - delete crashreporter; - return true; + delete crashreporter; + return true; } hal_sandbox::PHalParent* @@ -2669,37 +2669,37 @@ ContentParent::DeallocPHalParent(hal_sandbox::PHalParent* aHal) PIndexedDBParent* ContentParent::AllocPIndexedDBParent() { - return new IndexedDBParent(this); + return new IndexedDBParent(this); } bool ContentParent::DeallocPIndexedDBParent(PIndexedDBParent* aActor) { - delete aActor; - return true; + delete aActor; + return true; } bool ContentParent::RecvPIndexedDBConstructor(PIndexedDBParent* aActor) { - nsRefPtr mgr = IndexedDatabaseManager::GetOrCreate(); - NS_ENSURE_TRUE(mgr, false); + nsRefPtr mgr = IndexedDatabaseManager::GetOrCreate(); + NS_ENSURE_TRUE(mgr, false); - if (!IndexedDatabaseManager::IsMainProcess()) { - NS_RUNTIMEABORT("Not supported yet!"); - } + if (!IndexedDatabaseManager::IsMainProcess()) { + NS_RUNTIMEABORT("Not supported yet!"); + } - nsRefPtr factory; - nsresult rv = IDBFactory::Create(this, getter_AddRefs(factory)); - NS_ENSURE_SUCCESS(rv, false); + nsRefPtr factory; + nsresult rv = IDBFactory::Create(this, getter_AddRefs(factory)); + NS_ENSURE_SUCCESS(rv, false); - NS_ASSERTION(factory, "This should never be null!"); + NS_ASSERTION(factory, "This should never be null!"); - IndexedDBParent* actor = static_cast(aActor); - actor->mFactory = factory; - actor->mASCIIOrigin = factory->GetASCIIOrigin(); + IndexedDBParent* actor = static_cast(aActor); + actor->mFactory = factory; + actor->mASCIIOrigin = factory->GetASCIIOrigin(); - return true; + return true; } PMemoryReportRequestParent* @@ -2707,15 +2707,15 @@ ContentParent::AllocPMemoryReportRequestParent(const uint32_t& generation, const bool &minimizeMemoryUsage, const nsString &aDMDDumpIdent) { - MemoryReportRequestParent* parent = new MemoryReportRequestParent(); - return parent; + MemoryReportRequestParent* parent = new MemoryReportRequestParent(); + return parent; } bool ContentParent::DeallocPMemoryReportRequestParent(PMemoryReportRequestParent* actor) { - delete actor; - return true; + delete actor; + return true; } PCycleCollectWithLogsParent* @@ -2747,14 +2747,14 @@ ContentParent::CycleCollectWithLogs(bool aDumpAllTraces, PTestShellParent* ContentParent::AllocPTestShellParent() { - return new TestShellParent(); + return new TestShellParent(); } bool ContentParent::DeallocPTestShellParent(PTestShellParent* shell) { - delete shell; - return true; + delete shell; + return true; } PNeckoParent* @@ -2923,14 +2923,14 @@ ContentParent::AllocPAsmJSCacheEntryParent( const asmjscache::WriteParams& aWriteParams, const IPC::Principal& aPrincipal) { - return asmjscache::AllocEntryParent(aOpenMode, aWriteParams, aPrincipal); + return asmjscache::AllocEntryParent(aOpenMode, aWriteParams, aPrincipal); } bool ContentParent::DeallocPAsmJSCacheEntryParent(PAsmJSCacheEntryParent* aActor) { - asmjscache::DeallocEntryParent(aActor); - return true; + asmjscache::DeallocEntryParent(aActor); + return true; } PSpeechSynthesisParent* @@ -2968,29 +2968,29 @@ bool ContentParent::RecvSpeakerManagerGetSpeakerStatus(bool* aValue) { #ifdef MOZ_WIDGET_GONK - *aValue = false; - nsRefPtr service = - SpeakerManagerService::GetSpeakerManagerService(); - if (service) { - *aValue = service->GetSpeakerStatus(); - } - return true; + *aValue = false; + nsRefPtr service = + SpeakerManagerService::GetSpeakerManagerService(); + if (service) { + *aValue = service->GetSpeakerStatus(); + } + return true; #endif - return false; + return false; } bool ContentParent::RecvSpeakerManagerForceSpeaker(const bool& aEnable) { #ifdef MOZ_WIDGET_GONK - nsRefPtr service = - SpeakerManagerService::GetSpeakerManagerService(); - if (service) { - service->ForceSpeaker(aEnable, mChildID); - } - return true; + nsRefPtr service = + SpeakerManagerService::GetSpeakerManagerService(); + if (service) { + service->ForceSpeaker(aEnable, mChildID); + } + return true; #endif - return false; + return false; } bool @@ -3063,15 +3063,15 @@ ContentParent::RecvGetRandomValues(const uint32_t& length, bool ContentParent::RecvGetSystemMemory(const uint64_t& aGetterId) { - uint32_t memoryTotal = 0; + uint32_t memoryTotal = 0; #if defined(XP_LINUX) - memoryTotal = mozilla::hal::GetTotalSystemMemoryLevel(); + memoryTotal = mozilla::hal::GetTotalSystemMemoryLevel(); #endif - unused << SendSystemMemoryAvailable(aGetterId, memoryTotal); + unused << SendSystemMemoryAvailable(aGetterId, memoryTotal); - return true; + return true; } @@ -3140,21 +3140,21 @@ ContentParent::RecvSyncMessage(const nsString& aMsg, const IPC::Principal& aPrincipal, InfallibleTArray* aRetvals) { - nsIPrincipal* principal = aPrincipal; - if (!Preferences::GetBool("dom.testing.ignore_ipc_principal", false) && - principal && !AssertAppPrincipal(this, principal)) { - return false; - } + nsIPrincipal* principal = aPrincipal; + if (!Preferences::GetBool("dom.testing.ignore_ipc_principal", false) && + principal && !AssertAppPrincipal(this, principal)) { + return false; + } - nsRefPtr ppm = mMessageManager; - if (ppm) { - StructuredCloneData cloneData = ipc::UnpackClonedMessageDataForParent(aData); - CpowIdHolder cpows(GetCPOWManager(), aCpows); + nsRefPtr ppm = mMessageManager; + if (ppm) { + StructuredCloneData cloneData = ipc::UnpackClonedMessageDataForParent(aData); + CpowIdHolder cpows(GetCPOWManager(), aCpows); - ppm->ReceiveMessage(static_cast(ppm.get()), - aMsg, true, &cloneData, &cpows, aPrincipal, aRetvals); - } - return true; + ppm->ReceiveMessage(static_cast(ppm.get()), + aMsg, true, &cloneData, &cpows, aPrincipal, aRetvals); + } + return true; } bool @@ -3164,20 +3164,20 @@ ContentParent::AnswerRpcMessage(const nsString& aMsg, const IPC::Principal& aPrincipal, InfallibleTArray* aRetvals) { - nsIPrincipal* principal = aPrincipal; - if (!Preferences::GetBool("dom.testing.ignore_ipc_principal", false) && - principal && !AssertAppPrincipal(this, principal)) { - return false; - } + nsIPrincipal* principal = aPrincipal; + if (!Preferences::GetBool("dom.testing.ignore_ipc_principal", false) && + principal && !AssertAppPrincipal(this, principal)) { + return false; + } - nsRefPtr ppm = mMessageManager; - if (ppm) { - StructuredCloneData cloneData = ipc::UnpackClonedMessageDataForParent(aData); - CpowIdHolder cpows(GetCPOWManager(), aCpows); - ppm->ReceiveMessage(static_cast(ppm.get()), - aMsg, true, &cloneData, &cpows, aPrincipal, aRetvals); - } - return true; + nsRefPtr ppm = mMessageManager; + if (ppm) { + StructuredCloneData cloneData = ipc::UnpackClonedMessageDataForParent(aData); + CpowIdHolder cpows(GetCPOWManager(), aCpows); + ppm->ReceiveMessage(static_cast(ppm.get()), + aMsg, true, &cloneData, &cpows, aPrincipal, aRetvals); + } + return true; } bool @@ -3186,20 +3186,20 @@ ContentParent::RecvAsyncMessage(const nsString& aMsg, const InfallibleTArray& aCpows, const IPC::Principal& aPrincipal) { - nsIPrincipal* principal = aPrincipal; - if (!Preferences::GetBool("dom.testing.ignore_ipc_principal", false) && - principal && !AssertAppPrincipal(this, principal)) { - return false; - } + nsIPrincipal* principal = aPrincipal; + if (!Preferences::GetBool("dom.testing.ignore_ipc_principal", false) && + principal && !AssertAppPrincipal(this, principal)) { + return false; + } - nsRefPtr ppm = mMessageManager; - if (ppm) { - StructuredCloneData cloneData = ipc::UnpackClonedMessageDataForParent(aData); - CpowIdHolder cpows(GetCPOWManager(), aCpows); - ppm->ReceiveMessage(static_cast(ppm.get()), - aMsg, false, &cloneData, &cpows, aPrincipal, nullptr); - } - return true; + nsRefPtr ppm = mMessageManager; + if (ppm) { + StructuredCloneData cloneData = ipc::UnpackClonedMessageDataForParent(aData); + CpowIdHolder cpows(GetCPOWManager(), aCpows); + ppm->ReceiveMessage(static_cast(ppm.get()), + aMsg, false, &cloneData, &cpows, aPrincipal, nullptr); + } + return true; } bool @@ -3224,18 +3224,18 @@ ContentParent::RecvFilePathUpdateNotify(const nsString& aType, static int32_t AddGeolocationListener(nsIDOMGeoPositionCallback* watcher, bool highAccuracy) { - nsCOMPtr geo = do_GetService("@mozilla.org/geolocation;1"); - if (!geo) { - return -1; - } + nsCOMPtr geo = do_GetService("@mozilla.org/geolocation;1"); + if (!geo) { + return -1; + } - PositionOptions* options = new PositionOptions(); - options->mTimeout = 0; - options->mMaximumAge = 0; - options->mEnableHighAccuracy = highAccuracy; - int32_t retval = 1; - geo->WatchPosition(watcher, nullptr, options, &retval); - return retval; + PositionOptions* options = new PositionOptions(); + options->mTimeout = 0; + options->mMaximumAge = 0; + options->mEnableHighAccuracy = highAccuracy; + int32_t retval = 1; + geo->WatchPosition(watcher, nullptr, options, &retval); + return retval; } bool @@ -3243,53 +3243,53 @@ ContentParent::RecvAddGeolocationListener(const IPC::Principal& aPrincipal, const bool& aHighAccuracy) { #ifdef MOZ_CHILD_PERMISSIONS - if (!Preferences::GetBool("dom.testing.ignore_ipc_principal", false)) { - uint32_t permission = mozilla::CheckPermission(this, aPrincipal, - "geolocation"); - if (permission != nsIPermissionManager::ALLOW_ACTION) { - return true; + if (!Preferences::GetBool("dom.testing.ignore_ipc_principal", false)) { + uint32_t permission = mozilla::CheckPermission(this, aPrincipal, + "geolocation"); + if (permission != nsIPermissionManager::ALLOW_ACTION) { + return true; + } } - } #endif /* MOZ_CHILD_PERMISSIONS */ - // To ensure no geolocation updates are skipped, we always force the - // creation of a new listener. - RecvRemoveGeolocationListener(); - mGeolocationWatchID = AddGeolocationListener(this, aHighAccuracy); - return true; + // To ensure no geolocation updates are skipped, we always force the + // creation of a new listener. + RecvRemoveGeolocationListener(); + mGeolocationWatchID = AddGeolocationListener(this, aHighAccuracy); + return true; } bool ContentParent::RecvRemoveGeolocationListener() { - if (mGeolocationWatchID != -1) { - nsCOMPtr geo = do_GetService("@mozilla.org/geolocation;1"); - if (!geo) { - return true; + if (mGeolocationWatchID != -1) { + nsCOMPtr geo = do_GetService("@mozilla.org/geolocation;1"); + if (!geo) { + return true; + } + geo->ClearWatch(mGeolocationWatchID); + mGeolocationWatchID = -1; } - geo->ClearWatch(mGeolocationWatchID); - mGeolocationWatchID = -1; - } - return true; + return true; } bool ContentParent::RecvSetGeolocationHigherAccuracy(const bool& aEnable) { - // This should never be called without a listener already present, - // so this check allows us to forgo securing privileges. - if (mGeolocationWatchID != -1) { - RecvRemoveGeolocationListener(); - mGeolocationWatchID = AddGeolocationListener(this, aEnable); - } - return true; + // This should never be called without a listener already present, + // so this check allows us to forgo securing privileges. + if (mGeolocationWatchID != -1) { + RecvRemoveGeolocationListener(); + mGeolocationWatchID = AddGeolocationListener(this, aEnable); + } + return true; } NS_IMETHODIMP ContentParent::HandleEvent(nsIDOMGeoPosition* postion) { - unused << SendGeolocationUpdate(GeoPosition(postion)); - return NS_OK; + unused << SendGeolocationUpdate(GeoPosition(postion)); + return NS_OK; } nsConsoleService * @@ -3312,14 +3312,14 @@ ContentParent::GetConsoleService() bool ContentParent::RecvConsoleMessage(const nsString& aMessage) { - nsRefPtr consoleService = GetConsoleService(); - if (!consoleService) { + nsRefPtr consoleService = GetConsoleService(); + if (!consoleService) { + return true; + } + + nsRefPtr msg(new nsConsoleMessage(aMessage.get())); + consoleService->LogMessageWithMode(msg, nsConsoleService::SuppressLog); return true; - } - - nsRefPtr msg(new nsConsoleMessage(aMessage.get())); - consoleService->LogMessageWithMode(msg, nsConsoleService::SuppressLog); - return true; } bool @@ -3331,38 +3331,38 @@ ContentParent::RecvScriptError(const nsString& aMessage, const uint32_t& aFlags, const nsCString& aCategory) { - nsRefPtr consoleService = GetConsoleService(); - if (!consoleService) { - return true; - } + nsRefPtr consoleService = GetConsoleService(); + if (!consoleService) { + return true; + } - nsCOMPtr msg(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID)); - nsresult rv = msg->Init(aMessage, aSourceName, aSourceLine, - aLineNumber, aColNumber, aFlags, aCategory.get()); - if (NS_FAILED(rv)) - return true; + nsCOMPtr msg(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID)); + nsresult rv = msg->Init(aMessage, aSourceName, aSourceLine, + aLineNumber, aColNumber, aFlags, aCategory.get()); + if (NS_FAILED(rv)) + return true; - consoleService->LogMessageWithMode(msg, nsConsoleService::SuppressLog); - return true; + consoleService->LogMessageWithMode(msg, nsConsoleService::SuppressLog); + return true; } bool ContentParent::RecvPrivateDocShellsExist(const bool& aExist) { - if (!sPrivateContent) - sPrivateContent = new nsTArray(); - if (aExist) { - sPrivateContent->AppendElement(this); - } else { - sPrivateContent->RemoveElement(this); - if (!sPrivateContent->Length()) { - nsCOMPtr obs = mozilla::services::GetObserverService(); - obs->NotifyObservers(nullptr, "last-pb-context-exited", nullptr); - delete sPrivateContent; - sPrivateContent = nullptr; + if (!sPrivateContent) + sPrivateContent = new nsTArray(); + if (aExist) { + sPrivateContent->AppendElement(this); + } else { + sPrivateContent->RemoveElement(this); + if (!sPrivateContent->Length()) { + nsCOMPtr obs = mozilla::services::GetObserverService(); + obs->NotifyObservers(nullptr, "last-pb-context-exited", nullptr); + delete sPrivateContent; + sPrivateContent = nullptr; + } } - } - return true; + return true; } bool @@ -3372,39 +3372,39 @@ ContentParent::DoSendAsyncMessage(JSContext* aCx, JS::Handle aCpows, nsIPrincipal* aPrincipal) { - ClonedMessageData data; - if (!BuildClonedMessageDataForParent(this, aData, data)) { - return false; - } - InfallibleTArray cpows; - if (aCpows && !GetCPOWManager()->Wrap(aCx, aCpows, &cpows)) { - return false; - } - return SendAsyncMessage(nsString(aMessage), data, cpows, aPrincipal); + ClonedMessageData data; + if (!BuildClonedMessageDataForParent(this, aData, data)) { + return false; + } + InfallibleTArray cpows; + if (aCpows && !GetCPOWManager()->Wrap(aCx, aCpows, &cpows)) { + return false; + } + return SendAsyncMessage(nsString(aMessage), data, cpows, aPrincipal); } bool ContentParent::CheckPermission(const nsAString& aPermission) { - return AssertAppProcessPermission(this, NS_ConvertUTF16toUTF8(aPermission).get()); + return AssertAppProcessPermission(this, NS_ConvertUTF16toUTF8(aPermission).get()); } bool ContentParent::CheckManifestURL(const nsAString& aManifestURL) { - return AssertAppProcessManifestURL(this, NS_ConvertUTF16toUTF8(aManifestURL).get()); + return AssertAppProcessManifestURL(this, NS_ConvertUTF16toUTF8(aManifestURL).get()); } bool ContentParent::CheckAppHasPermission(const nsAString& aPermission) { - return AssertAppHasPermission(this, NS_ConvertUTF16toUTF8(aPermission).get()); + return AssertAppHasPermission(this, NS_ConvertUTF16toUTF8(aPermission).get()); } bool ContentParent::CheckAppHasStatus(unsigned short aStatus) { - return AssertAppHasStatus(this, aStatus); + return AssertAppHasStatus(this, aStatus); } bool @@ -3418,15 +3418,15 @@ bool ContentParent::RecvCreateFakeVolume(const nsString& fsName, const nsString& mountPoint) { #ifdef MOZ_WIDGET_GONK - nsresult rv; - nsCOMPtr vs = do_GetService(NS_VOLUMESERVICE_CONTRACTID, &rv); - if (vs) { - vs->CreateFakeVolume(fsName, mountPoint); - } - return true; + nsresult rv; + nsCOMPtr vs = do_GetService(NS_VOLUMESERVICE_CONTRACTID, &rv); + if (vs) { + vs->CreateFakeVolume(fsName, mountPoint); + } + return true; #else - NS_WARNING("ContentParent::RecvCreateFakeVolume shouldn't be called when MOZ_WIDGET_GONK is not defined"); - return false; + NS_WARNING("ContentParent::RecvCreateFakeVolume shouldn't be called when MOZ_WIDGET_GONK is not defined"); + return false; #endif } @@ -3434,15 +3434,15 @@ bool ContentParent::RecvSetFakeVolumeState(const nsString& fsName, const int32_t& fsState) { #ifdef MOZ_WIDGET_GONK - nsresult rv; - nsCOMPtr vs = do_GetService(NS_VOLUMESERVICE_CONTRACTID, &rv); - if (vs) { - vs->SetFakeVolumeState(fsName, fsState); - } - return true; + nsresult rv; + nsCOMPtr vs = do_GetService(NS_VOLUMESERVICE_CONTRACTID, &rv); + if (vs) { + vs->SetFakeVolumeState(fsName, fsState); + } + return true; #else - NS_WARNING("ContentParent::RecvSetFakeVolumeState shouldn't be called when MOZ_WIDGET_GONK is not defined"); - return false; + NS_WARNING("ContentParent::RecvSetFakeVolumeState shouldn't be called when MOZ_WIDGET_GONK is not defined"); + return false; #endif } @@ -3450,42 +3450,42 @@ bool ContentParent::RecvKeywordToURI(const nsCString& aKeyword, OptionalInputStreamParams* aPostData, OptionalURIParams* aURI) { - nsCOMPtr fixup = do_GetService(NS_URIFIXUP_CONTRACTID); - if (!fixup) { + nsCOMPtr fixup = do_GetService(NS_URIFIXUP_CONTRACTID); + if (!fixup) { + return true; + } + + nsCOMPtr postData; + nsCOMPtr uri; + if (NS_FAILED(fixup->KeywordToURI(aKeyword, getter_AddRefs(postData), + getter_AddRefs(uri)))) { + return true; + } + + nsTArray fds; + SerializeInputStream(postData, *aPostData, fds); + MOZ_ASSERT(fds.IsEmpty()); + + SerializeURI(uri, *aURI); return true; - } - - nsCOMPtr postData; - nsCOMPtr uri; - if (NS_FAILED(fixup->KeywordToURI(aKeyword, getter_AddRefs(postData), - getter_AddRefs(uri)))) { - return true; - } - - nsTArray fds; - SerializeInputStream(postData, *aPostData, fds); - MOZ_ASSERT(fds.IsEmpty()); - - SerializeURI(uri, *aURI); - return true; } bool ContentParent::ShouldContinueFromReplyTimeout() { - // The only time ContentParent sends blocking messages is for CPOWs, so - // timeouts should only ever occur in electrolysis-enabled sessions. - MOZ_ASSERT(BrowserTabsRemote()); - return false; + // The only time ContentParent sends blocking messages is for CPOWs, so + // timeouts should only ever occur in electrolysis-enabled sessions. + MOZ_ASSERT(BrowserTabsRemote()); + return false; } bool ContentParent::ShouldSandboxContentProcesses() { #ifdef MOZ_CONTENT_SANDBOX - return !PR_GetEnv("MOZ_DISABLE_CONTENT_SANDBOX"); + return !PR_GetEnv("MOZ_DISABLE_CONTENT_SANDBOX"); #else - return true; + return true; #endif } @@ -3534,33 +3534,33 @@ ContentParent::RecvGetGraphicsFeatureStatus(const int32_t& aFeature, bool ContentParent::RecvAddIdleObserver(const uint64_t& aObserver, const uint32_t& aIdleTimeInS) { - nsresult rv; - nsCOMPtr idleService = - do_GetService("@mozilla.org/widget/idleservice;1", &rv); - NS_ENSURE_SUCCESS(rv, false); + nsresult rv; + nsCOMPtr idleService = + do_GetService("@mozilla.org/widget/idleservice;1", &rv); + NS_ENSURE_SUCCESS(rv, false); - nsRefPtr listener = new ParentIdleListener(this, aObserver); - mIdleListeners.Put(aObserver, listener); - idleService->AddIdleObserver(listener, aIdleTimeInS); - return true; + nsRefPtr listener = new ParentIdleListener(this, aObserver); + mIdleListeners.Put(aObserver, listener); + idleService->AddIdleObserver(listener, aIdleTimeInS); + return true; } bool ContentParent::RecvRemoveIdleObserver(const uint64_t& aObserver, const uint32_t& aIdleTimeInS) { - nsresult rv; - nsCOMPtr idleService = - do_GetService("@mozilla.org/widget/idleservice;1", &rv); - NS_ENSURE_SUCCESS(rv, false); + nsresult rv; + nsCOMPtr idleService = + do_GetService("@mozilla.org/widget/idleservice;1", &rv); + NS_ENSURE_SUCCESS(rv, false); - nsRefPtr listener; - bool found = mIdleListeners.Get(aObserver, &listener); - if (found) { - mIdleListeners.Remove(aObserver); - idleService->RemoveIdleObserver(listener, aIdleTimeInS); - } + nsRefPtr listener; + bool found = mIdleListeners.Get(aObserver, &listener); + if (found) { + mIdleListeners.Remove(aObserver); + idleService->RemoveIdleObserver(listener, aIdleTimeInS); + } - return true; + return true; } bool @@ -3573,7 +3573,7 @@ ContentParent::RecvBackUpXResources(const FileDescriptor& aXSocketFd) "Already backed up X resources??"); mChildXSocketFdDup.forget(); if (aXSocketFd.IsValid()) { - mChildXSocketFdDup.reset(aXSocketFd.PlatformHandle()); + mChildXSocketFdDup.reset(aXSocketFd.PlatformHandle()); } #endif return true; @@ -3599,8 +3599,8 @@ NS_IMPL_ISUPPORTS(ParentIdleListener, nsIObserver) NS_IMETHODIMP ParentIdleListener::Observe(nsISupports*, const char* aTopic, const char16_t* aData) { - mozilla::unused << mParent->SendNotifyIdleObserver(mObserver, - nsDependentCString(aTopic), - nsDependentString(aData)); - return NS_OK; + mozilla::unused << mParent->SendNotifyIdleObserver(mObserver, + nsDependentCString(aTopic), + nsDependentString(aData)); + return NS_OK; } diff --git a/dom/mobilemessage/src/gonk/MmsService.js b/dom/mobilemessage/src/gonk/MmsService.js index 8d5f6d1b7509..ca92c2e15471 100644 --- a/dom/mobilemessage/src/gonk/MmsService.js +++ b/dom/mobilemessage/src/gonk/MmsService.js @@ -98,8 +98,20 @@ const DELIVERY_STATUS_NOT_APPLICABLE = "not-applicable"; const PREF_SEND_RETRY_COUNT = Services.prefs.getIntPref("dom.mms.sendRetryCount"); -const PREF_SEND_RETRY_INTERVAL = - Services.prefs.getIntPref("dom.mms.sendRetryInterval"); +const PREF_SEND_RETRY_INTERVAL = (function () { + let intervals = + Services.prefs.getCharPref("dom.mms.sendRetryInterval").split(","); + for (let i = 0; i < PREF_SEND_RETRY_COUNT; ++i) { + intervals[i] = parseInt(intervals[i], 10); + // If one of the intervals isn't valid (e.g., 0 or NaN), + // assign a 1-minute interval to it as a default. + if (!intervals[i]) { + intervals[i] = 60000; + } + } + intervals.length = PREF_SEND_RETRY_COUNT; + return intervals; +})(); const PREF_RETRIEVAL_RETRY_COUNT = Services.prefs.getIntPref("dom.mms.retrievalRetryCount"); @@ -1266,15 +1278,13 @@ SendTransaction.prototype = Object.create(CancellableTransaction.prototype, { MMS.MMS_PDU_ERROR_PERMANENT_FAILURE == mmsStatus) && this.retryCount < PREF_SEND_RETRY_COUNT) { if (DEBUG) { - debug("Fail to send. Will retry after: " + PREF_SEND_RETRY_INTERVAL); + debug("Fail to send. Will retry after: " + PREF_SEND_RETRY_INTERVAL[this.retryCount]); } if (this.timer == null) { this.timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); } - this.retryCount++; - // the input stream may be read in the previous failure request so // we have to re-compose it. if (this.istreamSize == null || @@ -1283,8 +1293,9 @@ SendTransaction.prototype = Object.create(CancellableTransaction.prototype, { } this.timer.initWithCallback(this.send.bind(this, retryCallback), - PREF_SEND_RETRY_INTERVAL, + PREF_SEND_RETRY_INTERVAL[this.retryCount], Ci.nsITimer.TYPE_ONE_SHOT); + this.retryCount++; return; } diff --git a/dom/nfc/nsNfc.js b/dom/nfc/nsNfc.js index 8690cfba47b0..f574194b91e2 100644 --- a/dom/nfc/nsNfc.js +++ b/dom/nfc/nsNfc.js @@ -55,15 +55,7 @@ MozNFCTag.prototype = { initialize: function(aWindow, aSessionToken) { this._window = aWindow; - this.setSessionToken(aSessionToken); - }, - - // ChromeOnly interface - setSessionToken: function setSessionToken(aSessionToken) { - debug("Setting session token."); this.session = aSessionToken; - // report to NFC worker: - this._nfcContentHelper.setSessionToken(aSessionToken); }, _techTypesMap: null, @@ -110,15 +102,7 @@ MozNFCPeer.prototype = { initialize: function(aWindow, aSessionToken) { this._window = aWindow; - this.setSessionToken(aSessionToken); - }, - - // ChromeOnly interface - setSessionToken: function setSessionToken(aSessionToken) { - debug("Setting session token."); this.session = aSessionToken; - // report to NFC worker: - return this._nfcContentHelper.setSessionToken(aSessionToken); }, // NFCPeer interface: @@ -200,26 +184,22 @@ mozNfc.prototype = { getNFCTag: function getNFCTag(sessionToken) { let obj = new MozNFCTag(); - let nfcTag = this._window.MozNFCTag._create(this._window, obj); - if (nfcTag) { - obj.initialize(this._window, sessionToken); - return nfcTag; - } else { - debug("Error: Unable to create NFCTag"); - return null; + obj.initialize(this._window, sessionToken); + if (this._nfcContentHelper.setSessionToken(sessionToken)) { + return this._window.MozNFCTag._create(this._window, obj); } + throw new Error("Unable to create NFCTag object, Reason: Bad SessionToken " + + sessionToken); }, getNFCPeer: function getNFCPeer(sessionToken) { let obj = new MozNFCPeer(); - let nfcPeer = this._window.MozNFCPeer._create(this._window, obj); - if (nfcPeer) { - obj.initialize(this._window, sessionToken); - return nfcPeer; - } else { - debug("Error: Unable to create NFCPeer"); - return null; + obj.initialize(this._window, sessionToken); + if (this._nfcContentHelper.setSessionToken(sessionToken)) { + return this._window.MozNFCPeer._create(this._window, obj); } + throw new Error("Unable to create NFCPeer object, Reason: Bad SessionToken " + + sessionToken); }, // get/set onpeerready diff --git a/dom/nfc/tests/marionette/test_nfc_peer.js b/dom/nfc/tests/marionette/test_nfc_peer.js index ffdc3674b620..c9d3e499b58e 100644 --- a/dom/nfc/tests/marionette/test_nfc_peer.js +++ b/dom/nfc/tests/marionette/test_nfc_peer.js @@ -85,9 +85,22 @@ function testCheckP2PRegFailure() { toggleNFC(true).then(() => activateRE(0)); } +function testCheckNfcPeerObjForInvalidToken() { + try { + // Use a'fakeSessionToken' + let peer = nfc.getNFCPeer("fakeSessionToken"); + ok(false, "Should not get a NFCPeer object."); + } catch (ex) { + ok(true, "Exception expected"); + } + + toggleNFC(false).then(runNextTest); +} + let tests = [ testPeerReady, - testCheckP2PRegFailure + testCheckP2PRegFailure, + testCheckNfcPeerObjForInvalidToken ]; SpecialPowers.pushPermissions( diff --git a/dom/system/gonk/Nfc.js b/dom/system/gonk/Nfc.js index 9d00caecb7a4..a0e162a669c6 100644 --- a/dom/system/gonk/Nfc.js +++ b/dom/system/gonk/Nfc.js @@ -366,10 +366,14 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function () { switch (msg.name) { case "NFC:SetSessionToken": + if (msg.json.sessionToken !== this.nfc.sessionTokenMap[this.nfc._currentSessionId]) { + debug("Received invalid Session Token: " + msg.json.sessionToken + " - Do not register this target"); + return NFC.NFC_ERROR_BAD_SESSION_ID; + } this._registerMessageTarget(this.nfc.sessionTokenMap[this.nfc._currentSessionId], msg.target); debug("Registering target for this SessionToken : " + this.nfc.sessionTokenMap[this.nfc._currentSessionId]); - return null; + return NFC.NFC_SUCCESS; case "NFC:RegisterPeerTarget": this.registerPeerTarget(msg); return null; diff --git a/dom/system/gonk/NfcContentHelper.js b/dom/system/gonk/NfcContentHelper.js index 395d2884f542..b31879c747e4 100644 --- a/dom/system/gonk/NfcContentHelper.js +++ b/dom/system/gonk/NfcContentHelper.js @@ -118,12 +118,13 @@ NfcContentHelper.prototype = { if (sessionToken == null) { throw Components.Exception("No session token!", Cr.NS_ERROR_UNEXPECTED); - return; + return false; } // Report session to Nfc.js only. - cpmm.sendAsyncMessage("NFC:SetSessionToken", { - sessionToken: sessionToken, + let val = cpmm.sendSyncMessage("NFC:SetSessionToken", { + sessionToken: sessionToken }); + return (val[0] === NFC.NFC_SUCCESS); }, // NFCTag interface diff --git a/dom/system/gonk/nsINfcContentHelper.idl b/dom/system/gonk/nsINfcContentHelper.idl index 2ee946dcc10f..a87d62d09d1c 100644 --- a/dom/system/gonk/nsINfcContentHelper.idl +++ b/dom/system/gonk/nsINfcContentHelper.idl @@ -24,13 +24,13 @@ interface nsINfcPeerCallback : nsISupports in DOMString sessionToken); }; -[scriptable, uuid(10b2eb1b-3fe0-4c98-9c67-9e4c2274cd78)] +[scriptable, uuid(26e8123f-ba00-4708-ac77-d1902457168c)] interface nsINfcContentHelper : nsISupports { const long NFC_EVENT_PEER_READY = 0x01; const long NFC_EVENT_PEER_LOST = 0x02; - void setSessionToken(in DOMString sessionToken); + boolean setSessionToken(in DOMString sessionToken); nsIDOMDOMRequest getDetailsNDEF(in nsIDOMWindow window, in DOMString sessionToken); nsIDOMDOMRequest readNDEF(in nsIDOMWindow window, in DOMString sessionToken); diff --git a/dom/webidl/BluetoothAdapter2.webidl b/dom/webidl/BluetoothAdapter2.webidl index 1be77505fe20..185c4cb14db0 100644 --- a/dom/webidl/BluetoothAdapter2.webidl +++ b/dom/webidl/BluetoothAdapter2.webidl @@ -32,13 +32,31 @@ dictionary MediaPlayStatus DOMString playStatus = ""; }; +enum BluetoothAdapterState +{ + "disabled", + "disabling", + "enabled", + "enabling" +}; + +enum BluetoothAdapterAttribute +{ + "unknown", + "state", + "address", + "name", + "discoverable", + "discovering" +}; + +[CheckPermissions="bluetooth"] interface BluetoothAdapter : EventTarget { - readonly attribute DOMString address; - readonly attribute unsigned long class; - readonly attribute boolean discovering; - readonly attribute DOMString name; - readonly attribute boolean discoverable; - readonly attribute unsigned long discoverableTimeout; // in seconds + readonly attribute BluetoothAdapterState state; + readonly attribute DOMString address; + readonly attribute DOMString name; + readonly attribute boolean discoverable; + readonly attribute boolean discovering; // array of type BluetoothDevice[] [GetterThrows] @@ -65,13 +83,14 @@ interface BluetoothAdapter : EventTarget { // Fired when remote devices query current media play status attribute EventHandler onrequestmediaplaystatus; + // Fired when attributes of BluetoothAdapter changed + attribute EventHandler onattributechanged; + [NewObject, Throws] DOMRequest setName(DOMString name); [NewObject, Throws] DOMRequest setDiscoverable(boolean discoverable); [NewObject, Throws] - DOMRequest setDiscoverableTimeout(unsigned long timeout); - [NewObject, Throws] DOMRequest startDiscovery(); [NewObject, Throws] DOMRequest stopDiscovery(); @@ -90,6 +109,18 @@ interface BluetoothAdapter : EventTarget { [NewObject, Throws] DOMRequest setPairingConfirmation(DOMString deviceAddress, boolean confirmation); + /** + * Enable/Disable a local bluetooth adapter by asynchronus methods and return + * its result through a Promise. + * Several onattributechanged event would be triggered during processing the + * request, and the last one would indicate adapter.state becomes + * enabled/disabled. + */ + // Promise + Promise enable(); + // Promise + Promise disable(); + /** * Connect/Disconnect to a specific service of a target remote device. * To check the value of service UUIDs, please check "Bluetooth Assigned diff --git a/dom/webidl/MozNFC.webidl b/dom/webidl/MozNFC.webidl index 28aed22dfba3..a615e94184a4 100644 --- a/dom/webidl/MozNFC.webidl +++ b/dom/webidl/MozNFC.webidl @@ -46,7 +46,9 @@ interface MozNFCManager { NavigatorProperty="mozNfc", Func="Navigator::HasNFCSupport"] interface MozNFC : EventTarget { + [Throws] MozNFCTag getNFCTag(DOMString sessionId); + [Throws] MozNFCPeer getNFCPeer(DOMString sessionId); [CheckPermissions="nfc-write"] diff --git a/dom/webidl/MozNFCPeer.webidl b/dom/webidl/MozNFCPeer.webidl index 10e93a704883..bd7a22ae6a19 100644 --- a/dom/webidl/MozNFCPeer.webidl +++ b/dom/webidl/MozNFCPeer.webidl @@ -18,6 +18,4 @@ interface MozNFCPeer { partial interface MozNFCPeer { [ChromeOnly] attribute DOMString session; - [ChromeOnly] - void setSessionToken(DOMString sessionToken); }; diff --git a/dom/webidl/MozNFCTag.webidl b/dom/webidl/MozNFCTag.webidl index 70b111963f78..5543ad4f8e82 100644 --- a/dom/webidl/MozNFCTag.webidl +++ b/dom/webidl/MozNFCTag.webidl @@ -38,6 +38,4 @@ interface MozNFCTag { partial interface MozNFCTag { [ChromeOnly] attribute DOMString session; - [ChromeOnly] - void setSessionToken(DOMString sessionToken); }; diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index 0de624fc2bd1..c0e6aa60edc7 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -4052,7 +4052,7 @@ pref("dom.mms.requestStatusReport", true); pref("dom.mms.retrieval_mode", "manual"); pref("dom.mms.sendRetryCount", 3); -pref("dom.mms.sendRetryInterval", 300000); +pref("dom.mms.sendRetryInterval", "10000,60000,180000"); pref("dom.mms.retrievalRetryCount", 4); pref("dom.mms.retrievalRetryIntervals", "60000,300000,600000,1800000");