From 9588efd947787422652f0955c24ee080e1b6806c Mon Sep 17 00:00:00 2001 From: Eric Chou Date: Mon, 9 Dec 2013 17:43:15 +0800 Subject: [PATCH 01/49] Bug 947060 - Don't go through bonding procedure while transferring files via OPP, r=gyeh --- dom/bluetooth/bluedroid/BluetoothOppManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dom/bluetooth/bluedroid/BluetoothOppManager.cpp b/dom/bluetooth/bluedroid/BluetoothOppManager.cpp index 3323ecbe54b..f83479754f2 100644 --- a/dom/bluetooth/bluedroid/BluetoothOppManager.cpp +++ b/dom/bluetooth/bluedroid/BluetoothOppManager.cpp @@ -261,7 +261,7 @@ BluetoothOppManager::ConnectInternal(const nsAString& aDeviceAddress) } mSocket = - new BluetoothSocket(this, BluetoothSocketType::RFCOMM, true, true); + new BluetoothSocket(this, BluetoothSocketType::RFCOMM, false, true); mSocket->Connect(aDeviceAddress, -1); } @@ -295,7 +295,7 @@ BluetoothOppManager::Listen() } mServerSocket = - new BluetoothSocket(this, BluetoothSocketType::RFCOMM, true, true); + new BluetoothSocket(this, BluetoothSocketType::RFCOMM, false, true); if (!mServerSocket->Listen(BluetoothReservedChannels::CHANNEL_OPUSH)) { BT_WARNING("[OPP] Can't listen on RFCOMM socket!"); From bde3b81d0233be4a84276b91ba3b09dd0b712c15 Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Mon, 9 Dec 2013 03:20:23 -0800 Subject: [PATCH 02/49] Bumping gaia.json for 1 gaia-central revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/f8d3d0e31a20 Author: Malini Das Desc: Bug 945284 - Bump gaiatest version to 0.20. r=dhunt --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 16ad7d351f0..263f214b6c1 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "7343851c97c278a338434d2632098a263e19bbb6", + "revision": "f8d3d0e31a201137e53f447d2518f93529bd7b4c", "repo_path": "/integration/gaia-central" } From 892438d6bd9678e7d9735dcd0525a8d6cb6ef671 Mon Sep 17 00:00:00 2001 From: Gene Lian Date: Mon, 9 Dec 2013 20:24:59 +0800 Subject: [PATCH 03/49] Bug 945711 - [Messages] We lose the 'body' information when migrating. r=vicamo a=v1.3+ --- dom/mobilemessage/src/gonk/MobileMessageDatabaseService.js | 1 + 1 file changed, 1 insertion(+) diff --git a/dom/mobilemessage/src/gonk/MobileMessageDatabaseService.js b/dom/mobilemessage/src/gonk/MobileMessageDatabaseService.js index 726749ef3d8..d56b18381d9 100644 --- a/dom/mobilemessage/src/gonk/MobileMessageDatabaseService.js +++ b/dom/mobilemessage/src/gonk/MobileMessageDatabaseService.js @@ -924,6 +924,7 @@ MobileMessageDatabaseService.prototype = { // Participant store cursor iteration done. if (!invalidParticipantIds.length) { next(); + return; } // Find affected thread. From 02b63a08034d2e0f333bb315621cad4289133e5d Mon Sep 17 00:00:00 2001 From: Vicamo Yang Date: Mon, 9 Dec 2013 21:02:54 +0800 Subject: [PATCH 04/49] Bug 944625 - B2G Emulator-x86: fix undeclared __NR_socketpair, __NR_sendmsg. r=kang,jld --- security/sandbox/linux/seccomp_filter.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/security/sandbox/linux/seccomp_filter.h b/security/sandbox/linux/seccomp_filter.h index b69f6cb0312..0dc610b4a88 100644 --- a/security/sandbox/linux/seccomp_filter.h +++ b/security/sandbox/linux/seccomp_filter.h @@ -81,6 +81,8 @@ ALLOW_SYSCALL(fstat64), \ ALLOW_SYSCALL(stat64), \ ALLOW_SYSCALL(lstat64), \ + ALLOW_SYSCALL(socketpair), \ + ALLOW_SYSCALL(sendmsg), \ ALLOW_SYSCALL(sigprocmask), #elif defined(__i386__) #define SECCOMP_WHITELIST_ARCH_TOREMOVE \ @@ -89,7 +91,9 @@ ALLOW_SYSCALL(lstat64), \ ALLOW_SYSCALL(sigprocmask), #else -#define SECCOMP_WHITELIST_ARCH_TOREMOVE +#define SECCOMP_WHITELIST_ARCH_TOREMOVE \ + ALLOW_SYSCALL(socketpair), \ + ALLOW_SYSCALL(sendmsg), #endif /* Architecture-specific syscalls for desktop linux */ @@ -252,8 +256,6 @@ ALLOW_SYSCALL(access), \ ALLOW_SYSCALL(unlink), \ ALLOW_SYSCALL(fsync), \ - ALLOW_SYSCALL(socketpair), \ - ALLOW_SYSCALL(sendmsg), \ /* Should remove all of the following in the future, if possible */ \ ALLOW_SYSCALL(getpriority), \ ALLOW_SYSCALL(setpriority), \ From 16f635c50485fb018099241bcccc2e1168ea067b Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Mon, 9 Dec 2013 14:21:18 +0100 Subject: [PATCH 05/49] Bug 936402: Duplicate connection status in UnixSocketImpl, r=bent UnixSocketImpl, which mostly runs on the I/O thread, doesn't control its reference to UnixSocketConsumer. If the connection status is stored in UnixSocketConsumer, the I/O thread can't read it safely. This patch duplicates the connection status in UnixSocketImpl, where reading from the I/O thread is safe. Methods of UnixSocketImpl don't need to access mConsumer any longer to obtain the connection status. --- ipc/unixsocket/UnixSocket.cpp | 39 ++++++++++++++++++++++++----------- ipc/unixsocket/UnixSocket.h | 2 ++ 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/ipc/unixsocket/UnixSocket.cpp b/ipc/unixsocket/UnixSocket.cpp index f352c18a110..7db20ebb73b 100644 --- a/ipc/unixsocket/UnixSocket.cpp +++ b/ipc/unixsocket/UnixSocket.cpp @@ -20,7 +20,6 @@ #include "mozilla/Util.h" #include "mozilla/FileUtils.h" #include "nsString.h" -#include "nsThreadUtils.h" #include "nsTArray.h" #include "nsXULAppAPI.h" @@ -44,13 +43,15 @@ class UnixSocketImpl : public MessageLoopForIO::Watcher { public: UnixSocketImpl(UnixSocketConsumer* aConsumer, UnixSocketConnector* aConnector, - const nsACString& aAddress) + const nsACString& aAddress, + SocketConnectionStatus aConnectionStatus) : mConsumer(aConsumer) , mIOLoop(nullptr) , mConnector(aConnector) , mShuttingDownOnIOThread(false) , mAddress(aAddress) , mDelayedConnectTask(nullptr) + , mConnectionStatus(aConnectionStatus) { } @@ -246,6 +247,12 @@ private: * Task member for delayed connect task. Should only be access on main thread. */ CancelableTask* mDelayedConnectTask; + + /** + * Socket connection status. Duplicate from UnixSocketConsumer. Should only + * be accessed on I/O thread. + */ + SocketConnectionStatus mConnectionStatus; }; template @@ -526,6 +533,7 @@ UnixSocketImpl::Accept() nsRefPtr t = new OnSocketEventTask(this, OnSocketEventTask::CONNECT_ERROR); NS_DispatchToMainThread(t); + mConnectionStatus = SOCKET_DISCONNECTED; return; } @@ -563,6 +571,7 @@ UnixSocketImpl::Connect() nsRefPtr t = new OnSocketEventTask(this, OnSocketEventTask::CONNECT_ERROR); NS_DispatchToMainThread(t); + mConnectionStatus = SOCKET_DISCONNECTED; return; } @@ -579,6 +588,7 @@ UnixSocketImpl::Connect() nsRefPtr t = new OnSocketEventTask(this, OnSocketEventTask::CONNECT_ERROR); NS_DispatchToMainThread(t); + mConnectionStatus = SOCKET_DISCONNECTED; return; } if (-1 == fcntl(mFd.get(), F_SETFL, current_opts & ~O_NONBLOCK)) { @@ -587,6 +597,7 @@ UnixSocketImpl::Connect() nsRefPtr t = new OnSocketEventTask(this, OnSocketEventTask::CONNECT_ERROR); NS_DispatchToMainThread(t); + mConnectionStatus = SOCKET_DISCONNECTED; return; } @@ -610,6 +621,7 @@ UnixSocketImpl::Connect() nsRefPtr t = new OnSocketEventTask(this, OnSocketEventTask::CONNECT_ERROR); NS_DispatchToMainThread(t); + mConnectionStatus = SOCKET_DISCONNECTED; return; } @@ -625,6 +637,7 @@ UnixSocketImpl::Connect() nsRefPtr t = new OnSocketEventTask(this, OnSocketEventTask::CONNECT_SUCCESS); NS_DispatchToMainThread(t); + mConnectionStatus = SOCKET_CONNECTED; SetUpIO(); } @@ -721,8 +734,7 @@ UnixSocketImpl::OnFileCanReadWithoutBlocking(int aFd) MOZ_ASSERT(!NS_IsMainThread()); MOZ_ASSERT(!mShuttingDownOnIOThread); - SocketConnectionStatus status = mConsumer->GetConnectionStatus(); - if (status == SOCKET_CONNECTED) { + if (mConnectionStatus == SOCKET_CONNECTED) { // Read all of the incoming data. while (true) { nsAutoPtr incoming(new UnixSocketRawData(MAX_READ_SIZE)); @@ -765,9 +777,7 @@ UnixSocketImpl::OnFileCanReadWithoutBlocking(int aFd) } MOZ_CRASH("We returned early"); - } - - if (status == SOCKET_LISTENING) { + } else if (mConnectionStatus == SOCKET_LISTENING) { int client_fd = accept(mFd.get(), (struct sockaddr*)&mAddr, &mAddrSize); if (client_fd < 0) { @@ -792,6 +802,7 @@ UnixSocketImpl::OnFileCanReadWithoutBlocking(int aFd) nsRefPtr t = new OnSocketEventTask(this, OnSocketEventTask::CONNECT_SUCCESS); NS_DispatchToMainThread(t); + mConnectionStatus = SOCKET_CONNECTED; SetUpIO(); } @@ -804,8 +815,7 @@ UnixSocketImpl::OnFileCanWriteWithoutBlocking(int aFd) MOZ_ASSERT(!mShuttingDownOnIOThread); MOZ_ASSERT(aFd >= 0); - SocketConnectionStatus status = mConsumer->GetConnectionStatus(); - if (status == SOCKET_CONNECTED) { + if (mConnectionStatus == SOCKET_CONNECTED) { // Try to write the bytes of mCurrentRilRawData. If all were written, continue. // // Otherwise, save the byte position of the next byte to write @@ -846,7 +856,7 @@ UnixSocketImpl::OnFileCanWriteWithoutBlocking(int aFd) mOutgoingQ.RemoveElementAt(0); delete data; } - } else if (status == SOCKET_CONNECTING) { + } else if (mConnectionStatus == SOCKET_CONNECTING) { int error, ret; socklen_t len = sizeof(error); ret = getsockopt(mFd.get(), SOL_SOCKET, SO_ERROR, &error, &len); @@ -857,6 +867,7 @@ UnixSocketImpl::OnFileCanWriteWithoutBlocking(int aFd) nsRefPtr t = new OnSocketEventTask(this, OnSocketEventTask::CONNECT_ERROR); NS_DispatchToMainThread(t); + mConnectionStatus = SOCKET_DISCONNECTED; return; } @@ -865,6 +876,7 @@ UnixSocketImpl::OnFileCanWriteWithoutBlocking(int aFd) nsRefPtr t = new OnSocketEventTask(this, OnSocketEventTask::CONNECT_ERROR); NS_DispatchToMainThread(t); + mConnectionStatus = SOCKET_DISCONNECTED; return; } @@ -874,12 +886,14 @@ UnixSocketImpl::OnFileCanWriteWithoutBlocking(int aFd) nsRefPtr t = new OnSocketEventTask(this, OnSocketEventTask::CONNECT_ERROR); NS_DispatchToMainThread(t); + mConnectionStatus = SOCKET_DISCONNECTED; return; } nsRefPtr t = new OnSocketEventTask(this, OnSocketEventTask::CONNECT_SUCCESS); NS_DispatchToMainThread(t); + mConnectionStatus = SOCKET_CONNECTED; SetUpIO(); } @@ -936,7 +950,7 @@ UnixSocketConsumer::ConnectSocket(UnixSocketConnector* aConnector, } nsCString addr(aAddress); - mImpl = new UnixSocketImpl(this, connector.forget(), addr); + mImpl = new UnixSocketImpl(this, connector.forget(), addr, SOCKET_CONNECTING); MessageLoop* ioLoop = XRE_GetIOMessageLoop(); mConnectionStatus = SOCKET_CONNECTING; if (aDelayMs > 0) { @@ -962,7 +976,8 @@ UnixSocketConsumer::ListenSocket(UnixSocketConnector* aConnector) return false; } - mImpl = new UnixSocketImpl(this, connector.forget(), EmptyCString()); + mImpl = new UnixSocketImpl(this, connector.forget(), EmptyCString(), + SOCKET_LISTENING); mConnectionStatus = SOCKET_LISTENING; XRE_GetIOMessageLoop()->PostTask(FROM_HERE, new SocketAcceptTask(mImpl)); diff --git a/ipc/unixsocket/UnixSocket.h b/ipc/unixsocket/UnixSocket.h index 3cbb552b6b8..70452f493b9 100644 --- a/ipc/unixsocket/UnixSocket.h +++ b/ipc/unixsocket/UnixSocket.h @@ -22,6 +22,7 @@ #include "nsString.h" #include "nsAutoPtr.h" #include "mozilla/RefPtr.h" +#include "nsThreadUtils.h" namespace mozilla { namespace ipc { @@ -165,6 +166,7 @@ public: SocketConnectionStatus GetConnectionStatus() const { + MOZ_ASSERT(NS_IsMainThread()); return mConnectionStatus; } From 9e77e68edf0ef45afc67fad791ac43fb678a3aad Mon Sep 17 00:00:00 2001 From: Vincent Chang Date: Mon, 25 Nov 2013 19:40:22 +0800 Subject: [PATCH 06/49] Bug 895753 - Rtsp: Support suspend and resume to media stream server. r=sworkman --- netwerk/protocol/rtsp/rtsp/RTSPSource.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/netwerk/protocol/rtsp/rtsp/RTSPSource.cpp b/netwerk/protocol/rtsp/rtsp/RTSPSource.cpp index c646532502d..f9b895af413 100644 --- a/netwerk/protocol/rtsp/rtsp/RTSPSource.cpp +++ b/netwerk/protocol/rtsp/rtsp/RTSPSource.cpp @@ -207,7 +207,16 @@ void RTSPSource::performPlay(int64_t playTimeUs) { if (mState == PAUSING) { playTimeUs = mLatestPausedUnit; } - LOGI("performPlay : %lld", playTimeUs); + + int64_t duration = 0; + getDuration(&duration); + MOZ_ASSERT(playTimeUs < duration, + "Should never receive an out of bounds play time!"); + if (playTimeUs >= duration) { + return; + } + + LOGI("performPlay : duration=%lld playTimeUs=%lld", duration, playTimeUs); mState = PLAYING; mHandler->play(playTimeUs); } @@ -238,13 +247,22 @@ void RTSPSource::performSeek(int64_t seekTimeUs) { if (mState != PLAYING && mState != PAUSING) { return; } - LOGI("performSeek: %llu", seekTimeUs); + + int64_t duration = 0; + getDuration(&duration); + MOZ_ASSERT(seekTimeUs < duration, + "Should never receive an out of bounds seek time!"); + if (seekTimeUs >= duration) { + return; + } + for (size_t i = 0; i < mTracks.size(); ++i) { TrackInfo *info = &mTracks.editItemAt(i); info->mLatestPausedUnit = 0; mLatestPausedUnit = 0; } + LOGI("performSeek: %llu", seekTimeUs); mState = SEEKING; mHandler->seek(seekTimeUs); } From f40c952ebe9d3968745c819c749bef8d09eb49b3 Mon Sep 17 00:00:00 2001 From: Ben Tian Date: Fri, 6 Dec 2013 12:20:07 +0800 Subject: [PATCH 07/49] Bug 946555 - Remove unused functions in BluetoothService classes and some warnings, r=echou --- dom/bluetooth/BluetoothHidManager.h | 2 +- dom/bluetooth/BluetoothProfileController.cpp | 4 +- dom/bluetooth/BluetoothRilListener.h | 3 + dom/bluetooth/BluetoothService.h | 20 ------- dom/bluetooth/BluetoothUtils.cpp | 2 +- .../bluedroid/BluetoothA2dpManager.h | 2 +- dom/bluetooth/bluedroid/BluetoothHfpManager.h | 2 +- .../bluedroid/BluetoothOppManager.cpp | 2 +- dom/bluetooth/bluedroid/BluetoothOppManager.h | 2 +- .../gonk/BluetoothServiceBluedroid.cpp | 57 ------------------- .../gonk/BluetoothServiceBluedroid.h | 33 ----------- dom/bluetooth/bluez/BluetoothA2dpManager.h | 2 +- dom/bluetooth/bluez/BluetoothHfpManager.cpp | 25 +++----- dom/bluetooth/bluez/BluetoothOppManager.cpp | 2 +- dom/bluetooth/bluez/BluetoothOppManager.h | 2 +- .../bluez/linux/BluetoothDBusService.cpp | 39 +------------ .../bluez/linux/BluetoothDBusService.h | 15 ----- .../ipc/BluetoothServiceChildProcess.cpp | 29 ---------- .../ipc/BluetoothServiceChildProcess.h | 11 ---- 19 files changed, 24 insertions(+), 230 deletions(-) diff --git a/dom/bluetooth/BluetoothHidManager.h b/dom/bluetooth/BluetoothHidManager.h index 41fccf56359..068acf2d8b1 100644 --- a/dom/bluetooth/BluetoothHidManager.h +++ b/dom/bluetooth/BluetoothHidManager.h @@ -25,7 +25,7 @@ public: } static BluetoothHidManager* Get(); - ~BluetoothHidManager(); + virtual ~BluetoothHidManager(); // HID-specific functions void HandleInputPropertyChanged(const BluetoothSignal& aSignal); diff --git a/dom/bluetooth/BluetoothProfileController.cpp b/dom/bluetooth/BluetoothProfileController.cpp index ed02a728daa..a6fd33648a9 100644 --- a/dom/bluetooth/BluetoothProfileController.cpp +++ b/dom/bluetooth/BluetoothProfileController.cpp @@ -187,9 +187,9 @@ BluetoothProfileController::Next() { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(!mDeviceAddress.IsEmpty()); - MOZ_ASSERT(mProfilesIndex < mProfiles.Length()); + MOZ_ASSERT(mProfilesIndex < (int)mProfiles.Length()); - if (++mProfilesIndex < mProfiles.Length()) { + if (++mProfilesIndex < (int)mProfiles.Length()) { BT_LOGR_PROFILE(mProfiles[mProfilesIndex], ""); if (mConnect) { diff --git a/dom/bluetooth/BluetoothRilListener.h b/dom/bluetooth/BluetoothRilListener.h index 44ca1a80c23..462280ef3b5 100644 --- a/dom/bluetooth/BluetoothRilListener.h +++ b/dom/bluetooth/BluetoothRilListener.h @@ -26,6 +26,7 @@ public: NS_DECL_NSIICCLISTENER IccListener() { } + virtual ~IccListener() { } bool Listen(bool aStart); void SetOwner(BluetoothRilListener *aOwner); @@ -42,6 +43,7 @@ public: MobileConnectionListener(uint32_t aClientId) : mClientId(aClientId) { } + virtual ~MobileConnectionListener() { } bool Listen(bool aStart); @@ -56,6 +58,7 @@ public: NS_DECL_NSITELEPHONYLISTENER TelephonyListener() { } + virtual ~TelephonyListener() { } bool Listen(bool aStart); }; diff --git a/dom/bluetooth/BluetoothService.h b/dom/bluetooth/BluetoothService.h index 2c525e90869..7adf497f97a 100644 --- a/dom/bluetooth/BluetoothService.h +++ b/dom/bluetooth/BluetoothService.h @@ -172,20 +172,6 @@ public: const BluetoothNamedValue& aValue, BluetoothReplyRunnable* aRunnable) = 0; - /** - * Get the path of a device - * - * @param aAdapterPath Path to the Adapter that's communicating with the device - * @param aDeviceAddress Device address (XX:XX:XX:XX:XX:XX format) - * @param aDevicePath Return value of path - * - * @return True if path set correctly, false otherwise - */ - virtual bool - GetDevicePath(const nsAString& aAdapterPath, - const nsAString& aDeviceAddress, - nsAString& aDevicePath) = 0; - virtual nsresult CreatePairedDeviceInternal(const nsAString& aAddress, int aTimeout, @@ -195,12 +181,6 @@ public: RemoveDeviceInternal(const nsAString& aObjectPath, BluetoothReplyRunnable* aRunnable) = 0; - virtual nsresult - GetScoSocket(const nsAString& aObjectPath, - bool aAuth, - bool aEncrypt, - mozilla::ipc::UnixSocketConsumer* aConsumer) = 0; - /** * Get corresponding service channel of specific service on remote device. * It's usually the very first step of establishing an outbound connection. diff --git a/dom/bluetooth/BluetoothUtils.cpp b/dom/bluetooth/BluetoothUtils.cpp index fb03577d766..55571587ae6 100644 --- a/dom/bluetooth/BluetoothUtils.cpp +++ b/dom/bluetooth/BluetoothUtils.cpp @@ -95,7 +95,7 @@ GetAddressFromObjectPath(const nsAString& aObjectPath) nsString address(aObjectPath); int addressHead = address.RFind("/") + 5; - MOZ_ASSERT(addressHead + BLUETOOTH_ADDRESS_LENGTH == address.Length()); + MOZ_ASSERT(addressHead + BLUETOOTH_ADDRESS_LENGTH == (int)address.Length()); address.Cut(0, addressHead); address.ReplaceChar('_', ':'); diff --git a/dom/bluetooth/bluedroid/BluetoothA2dpManager.h b/dom/bluetooth/bluedroid/BluetoothA2dpManager.h index c690e7965cc..e373b26cc46 100644 --- a/dom/bluetooth/bluedroid/BluetoothA2dpManager.h +++ b/dom/bluetooth/bluedroid/BluetoothA2dpManager.h @@ -32,7 +32,7 @@ public: }; static BluetoothA2dpManager* Get(); - ~BluetoothA2dpManager(); + virtual ~BluetoothA2dpManager(); void ResetA2dp(); void ResetAvrcp(); diff --git a/dom/bluetooth/bluedroid/BluetoothHfpManager.h b/dom/bluetooth/bluedroid/BluetoothHfpManager.h index 632ed667780..a0178559b28 100644 --- a/dom/bluetooth/bluedroid/BluetoothHfpManager.h +++ b/dom/bluetooth/bluedroid/BluetoothHfpManager.h @@ -84,7 +84,7 @@ public: } static BluetoothHfpManager* Get(); - ~BluetoothHfpManager(); + virtual ~BluetoothHfpManager(); bool ConnectSco(); bool DisconnectSco(); diff --git a/dom/bluetooth/bluedroid/BluetoothOppManager.cpp b/dom/bluetooth/bluedroid/BluetoothOppManager.cpp index f83479754f2..3856ebb1824 100644 --- a/dom/bluetooth/bluedroid/BluetoothOppManager.cpp +++ b/dom/bluetooth/bluedroid/BluetoothOppManager.cpp @@ -315,7 +315,7 @@ BluetoothOppManager::StartSendingNextFile() MOZ_ASSERT(!IsConnected()); MOZ_ASSERT(!mBatches.IsEmpty()); - MOZ_ASSERT(mBatches[0].mBlobs.Length() > mCurrentBlobIndex + 1); + MOZ_ASSERT((int)mBatches[0].mBlobs.Length() > mCurrentBlobIndex + 1); mBlob = mBatches[0].mBlobs[++mCurrentBlobIndex]; diff --git a/dom/bluetooth/bluedroid/BluetoothOppManager.h b/dom/bluetooth/bluedroid/BluetoothOppManager.h index 0642c2457ce..878224eef6f 100644 --- a/dom/bluetooth/bluedroid/BluetoothOppManager.h +++ b/dom/bluetooth/bluedroid/BluetoothOppManager.h @@ -45,7 +45,7 @@ public: static const int DEFAULT_OPP_CHANNEL = 10; static const int MAX_PACKET_LENGTH = 0xFFFE; - ~BluetoothOppManager(); + virtual ~BluetoothOppManager(); static BluetoothOppManager* Get(); void ClientDataHandler(mozilla::ipc::UnixSocketRawData* aMessage); void ServerDataHandler(mozilla::ipc::UnixSocketRawData* aMessage); diff --git a/dom/bluetooth/bluedroid/gonk/BluetoothServiceBluedroid.cpp b/dom/bluetooth/bluedroid/gonk/BluetoothServiceBluedroid.cpp index 29e94906dae..9de307338b2 100644 --- a/dom/bluetooth/bluedroid/gonk/BluetoothServiceBluedroid.cpp +++ b/dom/bluetooth/bluedroid/gonk/BluetoothServiceBluedroid.cpp @@ -965,13 +965,6 @@ BluetoothServiceBluedroid::StopDiscoveryInternal( return NS_OK; } -nsresult -BluetoothServiceBluedroid::GetDevicePropertiesInternal( - const BluetoothSignal& aSignal) -{ - return NS_OK; -} - nsresult BluetoothServiceBluedroid::SetProperty(BluetoothObjectType aType, const BluetoothNamedValue& aValue, @@ -1033,56 +1026,6 @@ BluetoothServiceBluedroid::SetProperty(BluetoothObjectType aType, return NS_OK; } -bool -BluetoothServiceBluedroid::GetDevicePath(const nsAString& aAdapterPath, - const nsAString& aDeviceAddress, - nsAString& aDevicePath) -{ - return true; -} - -bool -BluetoothServiceBluedroid::AddServiceRecords(const char* serviceName, - unsigned long long uuidMsb, - unsigned long long uuidLsb, - int channel) -{ - return true; -} - -bool -BluetoothServiceBluedroid::RemoveServiceRecords(const char* serviceName, - unsigned long long uuidMsb, - unsigned long long uuidLsb, - int channel) -{ - return true; -} - -bool -BluetoothServiceBluedroid::AddReservedServicesInternal( - const nsTArray& aServices, - nsTArray& aServiceHandlesContainer) -{ - return true; - -} - -bool -BluetoothServiceBluedroid::RemoveReservedServicesInternal( - const nsTArray& aServiceHandles) -{ - return true; -} - -nsresult -BluetoothServiceBluedroid::GetScoSocket( - const nsAString& aObjectPath, bool aAuth, bool aEncrypt, - mozilla::ipc::UnixSocketConsumer* aConsumer) -{ - return NS_OK; -} - nsresult BluetoothServiceBluedroid::GetServiceChannel( const nsAString& aDeviceAddress, diff --git a/dom/bluetooth/bluedroid/gonk/BluetoothServiceBluedroid.h b/dom/bluetooth/bluedroid/gonk/BluetoothServiceBluedroid.h index 9a3f228f958..c362e4bef12 100644 --- a/dom/bluetooth/bluedroid/gonk/BluetoothServiceBluedroid.h +++ b/dom/bluetooth/bluedroid/gonk/BluetoothServiceBluedroid.h @@ -49,44 +49,11 @@ public: virtual nsresult StartDiscoveryInternal(BluetoothReplyRunnable* aRunnable); virtual nsresult StopDiscoveryInternal(BluetoothReplyRunnable* aRunnable); - virtual nsresult - GetDevicePropertiesInternal(const BluetoothSignal& aSignal); - virtual nsresult SetProperty(BluetoothObjectType aType, const BluetoothNamedValue& aValue, BluetoothReplyRunnable* aRunnable); - virtual bool - GetDevicePath(const nsAString& aAdapterPath, - const nsAString& aDeviceAddress, - nsAString& aDevicePath); - - static bool - AddServiceRecords(const char* serviceName, - unsigned long long uuidMsb, - unsigned long long uuidLsb, - int channel); - - static bool - RemoveServiceRecords(const char* serviceName, - unsigned long long uuidMsb, - unsigned long long uuidLsb, - int channel); - - static bool - AddReservedServicesInternal(const nsTArray& aServices, - nsTArray& aServiceHandlesContainer); - - static bool - RemoveReservedServicesInternal(const nsTArray& aServiceHandles); - - virtual nsresult - GetScoSocket(const nsAString& aObjectPath, - bool aAuth, - bool aEncrypt, - mozilla::ipc::UnixSocketConsumer* aConsumer); - virtual nsresult GetServiceChannel(const nsAString& aDeviceAddress, const nsAString& aServiceUuid, diff --git a/dom/bluetooth/bluez/BluetoothA2dpManager.h b/dom/bluetooth/bluez/BluetoothA2dpManager.h index 70d88f34557..2c7d6bb8355 100644 --- a/dom/bluetooth/bluez/BluetoothA2dpManager.h +++ b/dom/bluetooth/bluez/BluetoothA2dpManager.h @@ -33,7 +33,7 @@ public: }; static BluetoothA2dpManager* Get(); - ~BluetoothA2dpManager(); + virtual ~BluetoothA2dpManager(); void ResetA2dp(); void ResetAvrcp(); diff --git a/dom/bluetooth/bluez/BluetoothHfpManager.cpp b/dom/bluetooth/bluez/BluetoothHfpManager.cpp index b223c13b534..26a979738d8 100644 --- a/dom/bluetooth/bluez/BluetoothHfpManager.cpp +++ b/dom/bluetooth/bluez/BluetoothHfpManager.cpp @@ -1018,7 +1018,7 @@ BluetoothHfpManager::ReceiveSocketData(BluetoothSocket* aSocket, for (uint8_t i = 0; i < atCommandValues.Length(); i++) { CINDType indicatorType = (CINDType) (i + 1); - if (indicatorType >= ArrayLength(sCINDItems)) { + if (indicatorType >= (int)ArrayLength(sCINDItems)) { // Ignore excess parameters at the end break; } @@ -1802,15 +1802,8 @@ BluetoothHfpManager::ConnectSco(BluetoothReplyRunnable* aRunnable) { MOZ_ASSERT(NS_IsMainThread()); - if (sInShutdown) { - BT_WARNING("ConnecteSco called while in shutdown!"); - return false; - } - - if (!IsConnected()) { - BT_WARNING("BluetoothHfpManager is not connected"); - return false; - } + NS_ENSURE_TRUE(!sInShutdown, false); + NS_ENSURE_TRUE(IsConnected(), false); SocketConnectionStatus status = mScoSocket->GetConnectionStatus(); if (status == SocketConnectionStatus::SOCKET_CONNECTED || @@ -1828,16 +1821,14 @@ BluetoothHfpManager::ConnectSco(BluetoothReplyRunnable* aRunnable) return false; } + // Stop listening mScoSocket->Disconnect(); - mScoRunnable = aRunnable; - - BluetoothService* bs = BluetoothService::Get(); - NS_ENSURE_TRUE(bs, false); - nsresult rv = bs->GetScoSocket(mDeviceAddress, true, false, mScoSocket); - + mScoSocket->Connect(NS_ConvertUTF16toUTF8(mDeviceAddress), -1); mScoSocketStatus = mScoSocket->GetConnectionStatus(); - return NS_SUCCEEDED(rv); + + mScoRunnable = aRunnable; + return true; } bool diff --git a/dom/bluetooth/bluez/BluetoothOppManager.cpp b/dom/bluetooth/bluez/BluetoothOppManager.cpp index a6e2f1fee10..c327925ae96 100644 --- a/dom/bluetooth/bluez/BluetoothOppManager.cpp +++ b/dom/bluetooth/bluez/BluetoothOppManager.cpp @@ -331,7 +331,7 @@ BluetoothOppManager::StartSendingNextFile() MOZ_ASSERT(!IsConnected()); MOZ_ASSERT(!mBatches.IsEmpty()); - MOZ_ASSERT(mBatches[0].mBlobs.Length() > mCurrentBlobIndex + 1); + MOZ_ASSERT((int)mBatches[0].mBlobs.Length() > mCurrentBlobIndex + 1); mBlob = mBatches[0].mBlobs[++mCurrentBlobIndex]; diff --git a/dom/bluetooth/bluez/BluetoothOppManager.h b/dom/bluetooth/bluez/BluetoothOppManager.h index 062032ac69d..c8c884c9953 100644 --- a/dom/bluetooth/bluez/BluetoothOppManager.h +++ b/dom/bluetooth/bluez/BluetoothOppManager.h @@ -45,7 +45,7 @@ public: static const int DEFAULT_OPP_CHANNEL = 10; static const int MAX_PACKET_LENGTH = 0xFFFE; - ~BluetoothOppManager(); + virtual ~BluetoothOppManager(); static BluetoothOppManager* Get(); void ClientDataHandler(mozilla::ipc::UnixSocketRawData* aMessage); void ServerDataHandler(mozilla::ipc::UnixSocketRawData* aMessage); diff --git a/dom/bluetooth/bluez/linux/BluetoothDBusService.cpp b/dom/bluetooth/bluez/linux/BluetoothDBusService.cpp index 18c614c78a7..46021841c10 100644 --- a/dom/bluetooth/bluez/linux/BluetoothDBusService.cpp +++ b/dom/bluetooth/bluez/linux/BluetoothDBusService.cpp @@ -174,7 +174,7 @@ static const char* sBluetoothDBusSignals[] = static nsRefPtr gThreadConnection; // Only A2DP and HID are authorized. -static nsTArray sAuthorizedServiceClass; +static nsTArray sAuthorizedServiceClass; // The object path of adpater which should be updated after switching Bluetooth. static nsString sAdapterPath; @@ -2366,7 +2366,7 @@ BluetoothDBusService::SetProperty(BluetoothObjectType aType, return NS_OK; } - MOZ_ASSERT(aType < ArrayLength(sBluetoothDBusIfaces)); + MOZ_ASSERT(aType < (int)ArrayLength(sBluetoothDBusIfaces)); MOZ_ASSERT(!sAdapterPath.IsEmpty()); const char* interface = sBluetoothDBusIfaces[aType]; @@ -2439,15 +2439,6 @@ BluetoothDBusService::SetProperty(BluetoothObjectType aType, return NS_OK; } -bool -BluetoothDBusService::GetDevicePath(const nsAString& aAdapterPath, - const nsAString& aDeviceAddress, - nsAString& aDevicePath) -{ - aDevicePath = GetObjectPathFromAddress(aAdapterPath, aDeviceAddress); - return true; -} - nsresult BluetoothDBusService::CreatePairedDeviceInternal( const nsAString& aDeviceAddress, @@ -2979,32 +2970,6 @@ BluetoothDBusService::UpdateSdpRecords(const nsAString& aDeviceAddress, DBUS_TYPE_INVALID); } -nsresult -BluetoothDBusService::GetScoSocket(const nsAString& aAddress, - bool aAuth, - bool aEncrypt, - mozilla::ipc::UnixSocketConsumer* aConsumer) -{ - MOZ_ASSERT(NS_IsMainThread()); - - if (!mConnection || !gThreadConnection) { - NS_ERROR("Bluetooth service not started yet!"); - return NS_ERROR_FAILURE; - } - - BluetoothUnixSocketConnector* c = - new BluetoothUnixSocketConnector(BluetoothSocketType::SCO, -1, - aAuth, aEncrypt); - - if (!aConsumer->ConnectSocket(c, NS_ConvertUTF16toUTF8(aAddress).get())) { - nsAutoString replyError; - replyError.AssignLiteral("SocketConnectionError"); - return NS_ERROR_FAILURE; - } - - return NS_OK; -} - void BluetoothDBusService::SendFile(const nsAString& aDeviceAddress, BlobParent* aBlobParent, diff --git a/dom/bluetooth/bluez/linux/BluetoothDBusService.h b/dom/bluetooth/bluez/linux/BluetoothDBusService.h index 341205a3496..251efd2982f 100644 --- a/dom/bluetooth/bluez/linux/BluetoothDBusService.h +++ b/dom/bluetooth/bluez/linux/BluetoothDBusService.h @@ -54,21 +54,6 @@ public: const BluetoothNamedValue& aValue, BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; - virtual bool - GetDevicePath(const nsAString& aAdapterPath, - const nsAString& aDeviceAddress, - nsAString& aDevicePath) MOZ_OVERRIDE; - - static bool - AddReservedServicesInternal(const nsTArray& aServices, - nsTArray& aServiceHandlesContainer); - - virtual nsresult - GetScoSocket(const nsAString& aObjectPath, - bool aAuth, - bool aEncrypt, - mozilla::ipc::UnixSocketConsumer* aConsumer) MOZ_OVERRIDE; - virtual nsresult GetServiceChannel(const nsAString& aDeviceAddress, const nsAString& aServiceUuid, diff --git a/dom/bluetooth/ipc/BluetoothServiceChildProcess.cpp b/dom/bluetooth/ipc/BluetoothServiceChildProcess.cpp index de9b8f16463..2ad030201c8 100644 --- a/dom/bluetooth/ipc/BluetoothServiceChildProcess.cpp +++ b/dom/bluetooth/ipc/BluetoothServiceChildProcess.cpp @@ -148,25 +148,6 @@ BluetoothServiceChildProcess::SetProperty(BluetoothObjectType aType, return NS_OK; } -bool -BluetoothServiceChildProcess::GetDevicePath(const nsAString& aAdapterPath, - const nsAString& aDeviceAddress, - nsAString& aDevicePath) -{ - // XXXbent Right now this is adapted from BluetoothDBusService's - // GetObjectPathFromAddress. This is basically a sync call that cannot - // be forwarded to the parent process without blocking. Hopefully this - // can be reworked. - nsAutoString path(aAdapterPath); - path.AppendLiteral("/dev_"); - path.Append(aDeviceAddress); - path.ReplaceChar(':', '_'); - - aDevicePath = path; - - return true; -} - nsresult BluetoothServiceChildProcess::CreatePairedDeviceInternal( const nsAString& aAddress, @@ -188,16 +169,6 @@ BluetoothServiceChildProcess::RemoveDeviceInternal( return NS_OK; } -nsresult -BluetoothServiceChildProcess::GetScoSocket( - const nsAString& aObjectPath, - bool aAuth, - bool aEncrypt, - mozilla::ipc::UnixSocketConsumer* aConsumer) -{ - MOZ_CRASH("This should never be called!"); -} - nsresult BluetoothServiceChildProcess::GetServiceChannel(const nsAString& aDeviceAddress, const nsAString& aServiceUuid, diff --git a/dom/bluetooth/ipc/BluetoothServiceChildProcess.h b/dom/bluetooth/ipc/BluetoothServiceChildProcess.h index ac8298fe6bd..b97384348e1 100644 --- a/dom/bluetooth/ipc/BluetoothServiceChildProcess.h +++ b/dom/bluetooth/ipc/BluetoothServiceChildProcess.h @@ -66,11 +66,6 @@ public: const BluetoothNamedValue& aValue, BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; - virtual bool - GetDevicePath(const nsAString& aAdapterPath, - const nsAString& aDeviceAddress, - nsAString& aDevicePath) MOZ_OVERRIDE; - virtual nsresult CreatePairedDeviceInternal(const nsAString& aAddress, int aTimeout, @@ -80,12 +75,6 @@ public: RemoveDeviceInternal(const nsAString& aObjectPath, BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; - virtual nsresult - GetScoSocket(const nsAString& aObjectPath, - bool aAuth, - bool aEncrypt, - mozilla::ipc::UnixSocketConsumer* aConsumer) MOZ_OVERRIDE; - virtual nsresult GetServiceChannel(const nsAString& aDeviceAddress, const nsAString& aServiceUuid, From 817a21e0cd78774d5502ef022ed5e8f9342f7e64 Mon Sep 17 00:00:00 2001 From: Alfredo Yang Date: Mon, 9 Dec 2013 09:35:03 -0500 Subject: [PATCH 08/49] Bug 853356 - Test: Check mediastream track according to request type. r=jsmith --- dom/media/tests/mochitest/Makefile.in | 6 ++ .../test_getUserMedia_permission.html | 75 +++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 dom/media/tests/mochitest/test_getUserMedia_permission.html diff --git a/dom/media/tests/mochitest/Makefile.in b/dom/media/tests/mochitest/Makefile.in index f0beca99b9a..b2406a19562 100644 --- a/dom/media/tests/mochitest/Makefile.in +++ b/dom/media/tests/mochitest/Makefile.in @@ -7,3 +7,9 @@ ifdef MOZ_WEBRTC_LEAKING_TESTS MOCHITEST_FILES += \ $(NULL) endif + +ifdef MOZ_B2G_CAMERA +MOCHITEST_FILES += \ + test_getUserMedia_permission.html \ + $(NULL) +endif diff --git a/dom/media/tests/mochitest/test_getUserMedia_permission.html b/dom/media/tests/mochitest/test_getUserMedia_permission.html new file mode 100644 index 00000000000..82c312446bb --- /dev/null +++ b/dom/media/tests/mochitest/test_getUserMedia_permission.html @@ -0,0 +1,75 @@ + + + + + + mozGetUserMedia Permission Test + + + + + + +Display camera/microphone permission acquisition prompt + + + + From c1149842d6825ba9908e255eaed55d667775bc31 Mon Sep 17 00:00:00 2001 From: Douglas Crosher Date: Sun, 8 Dec 2013 17:39:21 +1100 Subject: [PATCH 09/49] Bug 947687 - Fix jit-tests remote harness push of tests/* to remote device. r=dminor --- js/src/tests/lib/jittests.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/js/src/tests/lib/jittests.py b/js/src/tests/lib/jittests.py index 650707f9b63..7998437b716 100755 --- a/js/src/tests/lib/jittests.py +++ b/js/src/tests/lib/jittests.py @@ -661,8 +661,7 @@ def run_tests_remote(tests, prefix, options): Test.CacheDir = posixpath.join(options.remote_test_root, '.js-cache') dm.mkDir(Test.CacheDir) - for path in os.listdir(JS_TESTS_DIR): - dm.pushDir(os.path.join(JS_TESTS_DIR, path), posixpath.join(jit_tests_dir, 'tests', path)) + dm.pushDir(JS_TESTS_DIR, posixpath.join(jit_tests_dir, 'tests'), timeout=600) dm.pushDir(os.path.dirname(TEST_DIR), options.remote_test_root, timeout=600) prefix[0] = os.path.join(options.remote_test_root, 'js') From a207e38bc5d348f807fe5f10af9ad576126dd1ef Mon Sep 17 00:00:00 2001 From: Patrick Wang Date: Fri, 29 Nov 2013 17:28:54 +0800 Subject: [PATCH 10/49] Bug 944665: Part 1: Move common initialization routine into a function. r=khuey --- dom/ipc/ContentParent.cpp | 188 +++++++++++++++++++++----------------- dom/ipc/ContentParent.h | 5 + 2 files changed, 107 insertions(+), 86 deletions(-) diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 8e21165c815..3530938b25b 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -1249,93 +1249,13 @@ ContentParent::ContentParent(mozIApplication* aApp, Open(mSubprocess->GetChannel(), mSubprocess->GetOwnedChildProcessHandle()); - // Set the subprocess's priority. We do this early on because we're likely - // /lowering/ the process's CPU and memory priority, which it has inherited - // from this process. - // - // This call can cause us to send IPC messages to the child process, so it - // must come after the Open() call above. - ProcessPriorityManager::SetProcessPriority(this, aInitialPriority); - - // NB: internally, this will send an IPC message to the child - // process to get it to create the CompositorChild. This - // message goes through the regular IPC queue for this - // channel, so delivery will happen-before any other messages - // we send. The CompositorChild must be created before any - // PBrowsers are created, because they rely on the Compositor - // already being around. (Creation is async, so can't happen - // on demand.) - bool useOffMainThreadCompositing = !!CompositorParent::CompositorLoop(); - if (useOffMainThreadCompositing) { - DebugOnly opened = PCompositor::Open(this); - MOZ_ASSERT(opened); - - if (Preferences::GetBool("layers.async-video.enabled",false)) { - opened = PImageBridge::Open(this); - MOZ_ASSERT(opened); - } - } - - nsCOMPtr registrySvc = nsChromeRegistry::GetService(); - nsChromeRegistryChrome* chromeRegistry = - static_cast(registrySvc.get()); - chromeRegistry->SendRegisteredChrome(this); - mMessageManager = nsFrameMessageManager::NewProcessMessageManager(this); - - if (gAppData) { - nsCString version(gAppData->version); - nsCString buildID(gAppData->buildID); - nsCString name(gAppData->name); - nsCString UAName(gAppData->UAName); - - // Sending all information to content process. - unused << SendAppInfo(version, buildID, name, UAName); - } - - nsStyleSheetService *sheetService = nsStyleSheetService::GetInstance(); - if (sheetService) { - // This looks like a lot of work, but in a normal browser session we just - // send two loads. - - nsCOMArray& agentSheets = *sheetService->AgentStyleSheets(); - for (uint32_t i = 0; i < agentSheets.Length(); i++) { - URIParams uri; - SerializeURI(agentSheets[i]->GetSheetURI(), uri); - unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::AGENT_SHEET); - } - - nsCOMArray& userSheets = *sheetService->UserStyleSheets(); - for (uint32_t i = 0; i < userSheets.Length(); i++) { - URIParams uri; - SerializeURI(userSheets[i]->GetSheetURI(), uri); - unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::USER_SHEET); - } - - nsCOMArray& authorSheets = *sheetService->AuthorStyleSheets(); - for (uint32_t i = 0; i < authorSheets.Length(); i++) { - URIParams uri; - SerializeURI(authorSheets[i]->GetSheetURI(), uri); - unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::AUTHOR_SHEET); - } - } - -#ifdef MOZ_CONTENT_SANDBOX - // Bug 921817. We enable the sandbox in RecvSetProcessPrivileges, - // which is where a preallocated process drops unnecessary privileges, - // but a non-preallocated process will already have changed its - // uid/gid/etc immediately after forking. Thus, we send this message, - // which is otherwise a no-op, to sandbox it at an appropriate point - // during startup. - if (aOSPrivileges != base::PRIVILEGES_INHERIT) { - if (!SendSetProcessPrivileges(base::PRIVILEGES_INHERIT)) { - KillHard(); - } - } -#endif + InitInternal(aInitialPriority, + true, /* Setup off-main thread compositing */ + true /* Send registered chrome */); } #ifdef MOZ_NUWA_PROCESS -static const FileDescriptor* +static const mozilla::ipc::FileDescriptor* FindFdProtocolFdMapping(const nsTArray& aFds, ProtocolId aProtoId) { @@ -1401,8 +1321,9 @@ ContentParent::ContentParent(ContentParent* aTemplate, priority = PROCESS_PRIORITY_FOREGROUND; } - ProcessPriorityManager::SetProcessPriority(this, priority); - mMessageManager = nsFrameMessageManager::NewProcessMessageManager(this); + InitInternal(priority, + false, /* Setup Off-main thread compositing */ + false /* Send registered chrome */); } #endif // MOZ_NUWA_PROCESS @@ -1432,6 +1353,101 @@ ContentParent::~ContentParent() } } +void +ContentParent::InitInternal(ProcessPriority aInitialPriority, + bool aSetupOffMainThreadCompositing, + bool aSendRegisteredChrome) +{ + // Set the subprocess's priority. We do this early on because we're likely + // /lowering/ the process's CPU and memory priority, which it has inherited + // from this process. + // + // This call can cause us to send IPC messages to the child process, so it + // must come after the Open() call above. + ProcessPriorityManager::SetProcessPriority(this, aInitialPriority); + + if (aSetupOffMainThreadCompositing) { + // NB: internally, this will send an IPC message to the child + // process to get it to create the CompositorChild. This + // message goes through the regular IPC queue for this + // channel, so delivery will happen-before any other messages + // we send. The CompositorChild must be created before any + // PBrowsers are created, because they rely on the Compositor + // already being around. (Creation is async, so can't happen + // on demand.) + bool useOffMainThreadCompositing = !!CompositorParent::CompositorLoop(); + if (useOffMainThreadCompositing) { + DebugOnly opened = PCompositor::Open(this); + MOZ_ASSERT(opened); + + if (Preferences::GetBool("layers.async-video.enabled",false)) { + opened = PImageBridge::Open(this); + MOZ_ASSERT(opened); + } + } + } + + if (aSendRegisteredChrome) { + nsCOMPtr registrySvc = nsChromeRegistry::GetService(); + nsChromeRegistryChrome* chromeRegistry = + static_cast(registrySvc.get()); + chromeRegistry->SendRegisteredChrome(this); + } + + mMessageManager = nsFrameMessageManager::NewProcessMessageManager(this); + + if (gAppData) { + nsCString version(gAppData->version); + nsCString buildID(gAppData->buildID); + nsCString name(gAppData->name); + nsCString UAName(gAppData->UAName); + + // Sending all information to content process. + unused << SendAppInfo(version, buildID, name, UAName); + } + + nsStyleSheetService *sheetService = nsStyleSheetService::GetInstance(); + if (sheetService) { + // This looks like a lot of work, but in a normal browser session we just + // send two loads. + + nsCOMArray& agentSheets = *sheetService->AgentStyleSheets(); + for (uint32_t i = 0; i < agentSheets.Length(); i++) { + URIParams uri; + SerializeURI(agentSheets[i]->GetSheetURI(), uri); + unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::AGENT_SHEET); + } + + nsCOMArray& userSheets = *sheetService->UserStyleSheets(); + for (uint32_t i = 0; i < userSheets.Length(); i++) { + URIParams uri; + SerializeURI(userSheets[i]->GetSheetURI(), uri); + unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::USER_SHEET); + } + + nsCOMArray& authorSheets = *sheetService->AuthorStyleSheets(); + for (uint32_t i = 0; i < authorSheets.Length(); i++) { + URIParams uri; + SerializeURI(authorSheets[i]->GetSheetURI(), uri); + unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::AUTHOR_SHEET); + } + } + +#ifdef MOZ_CONTENT_SANDBOX + // Bug 921817. We enable the sandbox in RecvSetProcessPrivileges, + // which is where a preallocated process drops unnecessary privileges, + // but a non-preallocated process will already have changed its + // uid/gid/etc immediately after forking. Thus, we send this message, + // which is otherwise a no-op, to sandbox it at an appropriate point + // during startup. + if (mOSPrivileges != base::PRIVILEGES_INHERIT) { + if (!SendSetProcessPrivileges(base::PRIVILEGES_INHERIT)) { + KillHard(); + } + } +#endif +} + bool ContentParent::IsAlive() { diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index b70b5616165..5e64ed2b556 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -265,6 +265,11 @@ private: // The common initialization for the constructors. void InitializeMembers(); + // The common initialization logic shared by all constuctors. + void InitInternal(ProcessPriority aPriority, + bool aSetupOffMainThreadCompositing, + bool aSendRegisteredChrome); + virtual ~ContentParent(); void Init(); From 1a8ff42721590c5a2ac49f6d4964071cba154a78 Mon Sep 17 00:00:00 2001 From: Patrick Wang Date: Fri, 29 Nov 2013 17:28:54 +0800 Subject: [PATCH 11/49] Bug 944665: Part 2: Call PreloadSlowThings after Nuwa fork. r=khuey --- dom/ipc/ContentChild.cpp | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index 082d2367093..5e9bc6b1def 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -1348,17 +1348,6 @@ PreloadSlowThings() TabChild::PreloadSlowThings(); -#ifdef MOZ_NUWA_PROCESS - // After preload of slow things, start freezing threads. - if (IsNuwaProcess()) { - // Perform GC before freezing the Nuwa process to reduce memory usage. - ContentChild::GetSingleton()->RecvGarbageCollect(); - - MessageLoop::current()-> - PostTask(FROM_HERE, - NewRunnableFunction(OnFinishNuwaPreparation)); - } -#endif } bool @@ -1369,15 +1358,32 @@ ContentChild::RecvAppInfo(const nsCString& version, const nsCString& buildID, mAppInfo.buildID.Assign(buildID); mAppInfo.name.Assign(name); mAppInfo.UAName.Assign(UAName); + + if (!Preferences::GetBool("dom.ipc.processPrelaunch.enabled", false)) { + return true; + } + // If we're part of the mozbrowser machinery, go ahead and start // preloading things. We can only do this for mozbrowser because // PreloadSlowThings() may set the docshell of the first TabChild // inactive, and we can only safely restore it to active from // BrowserElementChild.js. - if ((mIsForApp || mIsForBrowser) && - Preferences::GetBool("dom.ipc.processPrelaunch.enabled", false)) { + if ((mIsForApp || mIsForBrowser) +#ifdef MOZ_NUWA_PROCESS + && !IsNuwaProcess() +#endif + ) { PreloadSlowThings(); } + +#ifdef MOZ_NUWA_PROCESS + if (IsNuwaProcess()) { + ContentChild::GetSingleton()->RecvGarbageCollect(); + MessageLoop::current()->PostTask( + FROM_HERE, NewRunnableFunction(OnFinishNuwaPreparation)); + } +#endif + return true; } From 38102985de2b8ed85163e7d5533967896f61a751 Mon Sep 17 00:00:00 2001 From: Patrick Wang Date: Thu, 24 Oct 2013 21:49:49 +0800 Subject: [PATCH 12/49] Bug 922465: Automated test for nuwa process. r=khuey --- dom/ipc/PreallocatedProcessManager.cpp | 17 ++++ dom/ipc/tests/mochitest.ini | 2 + dom/ipc/tests/moz.build | 1 + dom/ipc/tests/test_NuwaProcessCreation.html | 99 +++++++++++++++++++++ 4 files changed, 119 insertions(+) create mode 100644 dom/ipc/tests/mochitest.ini create mode 100644 dom/ipc/tests/test_NuwaProcessCreation.html diff --git a/dom/ipc/PreallocatedProcessManager.cpp b/dom/ipc/PreallocatedProcessManager.cpp index 6322a7342d7..404a8d703d8 100644 --- a/dom/ipc/PreallocatedProcessManager.cpp +++ b/dom/ipc/PreallocatedProcessManager.cpp @@ -281,6 +281,15 @@ PreallocatedProcessManagerImpl::PublishSpareProcess(ContentParent* aContent) { MOZ_ASSERT(NS_IsMainThread()); + if (Preferences::GetBool("dom.ipc.processPriorityManager.testMode")) { + AutoJSContext cx; + nsCOMPtr ppmm = + do_GetService("@mozilla.org/parentprocessmessagemanager;1"); + nsresult rv = ppmm->BroadcastAsyncMessage( + NS_LITERAL_STRING("TEST-ONLY:nuwa-add-new-process"), + JSVAL_NULL, JSVAL_NULL, cx, 1); + } + if (!mNuwaForkWaitTasks.IsEmpty()) { mNuwaForkWaitTasks.ElementAt(0)->Cancel(); mNuwaForkWaitTasks.RemoveElementAt(0); @@ -312,6 +321,14 @@ PreallocatedProcessManagerImpl::OnNuwaReady() ProcessPriorityManager::SetProcessPriority(mPreallocatedAppProcess, hal::PROCESS_PRIORITY_FOREGROUND); mIsNuwaReady = true; + if (Preferences::GetBool("dom.ipc.processPriorityManager.testMode")) { + AutoJSContext cx; + nsCOMPtr ppmm = + do_GetService("@mozilla.org/parentprocessmessagemanager;1"); + nsresult rv = ppmm->BroadcastAsyncMessage( + NS_LITERAL_STRING("TEST-ONLY:nuwa-ready"), + JSVAL_NULL, JSVAL_NULL, cx, 1); + } NuwaFork(); } diff --git a/dom/ipc/tests/mochitest.ini b/dom/ipc/tests/mochitest.ini new file mode 100644 index 00000000000..2f594dd8c01 --- /dev/null +++ b/dom/ipc/tests/mochitest.ini @@ -0,0 +1,2 @@ +[test_NuwaProcessCreation.html] +run-if = toolkit == 'gonk' diff --git a/dom/ipc/tests/moz.build b/dom/ipc/tests/moz.build index 87c88dfddbc..5244ac16b12 100644 --- a/dom/ipc/tests/moz.build +++ b/dom/ipc/tests/moz.build @@ -5,4 +5,5 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. MOCHITEST_CHROME_MANIFESTS += ['chrome.ini'] +MOCHITEST_MANIFESTS += ['mochitest.ini'] diff --git a/dom/ipc/tests/test_NuwaProcessCreation.html b/dom/ipc/tests/test_NuwaProcessCreation.html new file mode 100644 index 00000000000..55c7e1636a0 --- /dev/null +++ b/dom/ipc/tests/test_NuwaProcessCreation.html @@ -0,0 +1,99 @@ + + + + + + + + + + + + From 0ab53c19becaf265653fb8e64b3e4dc61245ee86 Mon Sep 17 00:00:00 2001 From: Patrick Wang Date: Tue, 15 Oct 2013 17:43:08 +0800 Subject: [PATCH 13/49] Bug 930282: Part 1: Enable Nuwa by default. r=khuey --- b2g/confvars.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/b2g/confvars.sh b/b2g/confvars.sh index 0f9e63d0402..c5cf779db8e 100644 --- a/b2g/confvars.sh +++ b/b2g/confvars.sh @@ -56,7 +56,9 @@ MOZ_TOOLKIT_SEARCH= MOZ_PLACES= MOZ_B2G=1 -#MOZ_NUWA_PROCESS=1 +if test "$OS_TARGET" = "Android"; then +MOZ_NUWA_PROCESS=1 +fi MOZ_FOLD_LIBS=1 MOZ_JSDOWNLOADS=1 From d713ee4776cc88b0cf5e868983000fab3245a2ca Mon Sep 17 00:00:00 2001 From: Cervantes Yu Date: Tue, 15 Oct 2013 17:43:08 +0800 Subject: [PATCH 14/49] Bug 930282: Part 2: Mark PACMan thread and BackgroundHangMonitor thread. r=khuey --- netwerk/base/src/nsPACMan.cpp | 10 ++++++++++ xpcom/threads/BackgroundHangMonitor.cpp | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/netwerk/base/src/nsPACMan.cpp b/netwerk/base/src/nsPACMan.cpp index 3b739701b0e..98431e7373e 100644 --- a/netwerk/base/src/nsPACMan.cpp +++ b/netwerk/base/src/nsPACMan.cpp @@ -14,6 +14,9 @@ #include "nsNetUtil.h" #include "nsIAsyncVerifyRedirectCallback.h" #include "nsISystemProxySettings.h" +#ifdef MOZ_NUWA_PROCESS +#include "ipc/Nuwa.h" +#endif //----------------------------------------------------------------------------- using namespace mozilla; @@ -674,6 +677,13 @@ nsPACMan::NamePACThread() { NS_ABORT_IF_FALSE(!NS_IsMainThread(), "wrong thread"); PR_SetCurrentThreadName("Proxy Resolution"); +#ifdef MOZ_NUWA_PROCESS + if (IsNuwaProcess()) { + NS_ASSERTION(NuwaMarkCurrentThread != nullptr, + "NuwaMarkCurrentThread is undefined!"); + NuwaMarkCurrentThread(nullptr, nullptr); + } +#endif } nsresult diff --git a/xpcom/threads/BackgroundHangMonitor.cpp b/xpcom/threads/BackgroundHangMonitor.cpp index a56b34bea87..723c481640a 100644 --- a/xpcom/threads/BackgroundHangMonitor.cpp +++ b/xpcom/threads/BackgroundHangMonitor.cpp @@ -11,6 +11,9 @@ #include "mozilla/Telemetry.h" #include "mozilla/ThreadHangStats.h" #include "mozilla/ThreadLocal.h" +#ifdef MOZ_NUWA_PROCESS +#include "ipc/Nuwa.h" +#endif #include "prinrval.h" #include "prthread.h" @@ -31,6 +34,15 @@ private: static void MonitorThread(void* aData) { PR_SetCurrentThreadName("BgHangManager"); + +#ifdef MOZ_NUWA_PROCESS + if (IsNuwaProcess()) { + NS_ASSERTION(NuwaMarkCurrentThread != nullptr, + "NuwaMarkCurrentThread is undefined!"); + NuwaMarkCurrentThread(nullptr, nullptr); + } +#endif + /* We do not hold a reference to BackgroundHangManager here because the monitor thread only exists as long as the BackgroundHangManager instance exists. We stop the monitor From 52fcf9c03107fb7b0d8fdf295bf4c5b9aecaf342 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kan-Ru=20Chen=20=28=E9=99=B3=E4=BE=83=E5=A6=82=29?= Date: Sun, 8 Dec 2013 23:28:47 +0800 Subject: [PATCH 15/49] Bug 941468 - Only load forms.js once per-process. r=yxl --- dom/browser-element/BrowserElementChild.js | 29 ++++++++++++++++++---- dom/inputmethod/Keyboard.jsm | 11 -------- dom/inputmethod/forms.js | 7 ------ 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/dom/browser-element/BrowserElementChild.js b/dom/browser-element/BrowserElementChild.js index 91023ef3c98..661b6c9e3b4 100644 --- a/dom/browser-element/BrowserElementChild.js +++ b/dom/browser-element/BrowserElementChild.js @@ -23,12 +23,31 @@ docShell.QueryInterface(Ci.nsIDocShellTreeItem).name = infos.name; docShell.setFullscreenAllowed(infos.fullscreenAllowed); -if (!('BrowserElementIsPreloaded' in this)) { - try { - if (Services.prefs.getBoolPref("dom.mozInputMethod.enabled")) { - Services.scriptloader.loadSubScript("chrome://global/content/forms.js"); +function parentDocShell(docshell) { + if (!docshell) { + return null; + } + let treeitem = docshell.QueryInterface(Ci.nsIDocShellTreeItem); + return treeitem.parent ? treeitem.parent.QueryInterface(Ci.nsIDocShell) : null; +} + +function isTopBrowserElement(docShell) { + while (docShell) { + docShell = parentDocShell(docShell); + if (docShell && docShell.isBrowserOrApp) { + return false; + } + } + return true; +} + +if (!('BrowserElementIsPreloaded' in this)) { + if (isTopBrowserElement(docShell) && + Services.prefs.getBoolPref("dom.mozInputMethod.enabled")) { + try { + Services.scriptloader.loadSubScript("chrome://global/content/forms.js"); + } catch (e) { } - } catch (e) { } // Those are produc-specific files that's sometimes unavailable. try { diff --git a/dom/inputmethod/Keyboard.jsm b/dom/inputmethod/Keyboard.jsm index 98f5cab3dbc..14b56041be6 100644 --- a/dom/inputmethod/Keyboard.jsm +++ b/dom/inputmethod/Keyboard.jsm @@ -9,7 +9,6 @@ this.EXPORTED_SYMBOLS = ['Keyboard']; const Cu = Components.utils; const Cc = Components.classes; const Ci = Components.interfaces; -const kFormsFrameScript = 'chrome://global/content/forms.js'; Cu.import('resource://gre/modules/Services.jsm'); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); @@ -80,16 +79,6 @@ this.Keyboard = { mm.addMessageListener('Forms:GetContext:Result:OK', this); mm.addMessageListener('Forms:SetComposition:Result:OK', this); mm.addMessageListener('Forms:EndComposition:Result:OK', this); - - // When not running apps OOP, we need to load forms.js here since this - // won't happen from dom/ipc/preload.js - try { - if (Services.prefs.getBoolPref("dom.ipc.tabs.disabled") === true) { - mm.loadFrameScript(kFormsFrameScript, true); - } - } catch (e) { - dump('Error loading ' + kFormsFrameScript + ' as frame script: ' + e + '\n'); - } }, receiveMessage: function keyboardReceiveMessage(msg) { diff --git a/dom/inputmethod/forms.js b/dom/inputmethod/forms.js index 15f6d7503aa..685db1f64db 100644 --- a/dom/inputmethod/forms.js +++ b/dom/inputmethod/forms.js @@ -26,7 +26,6 @@ XPCOMUtils.defineLazyGetter(this, "domWindowUtils", function () { const RESIZE_SCROLL_DELAY = 20; let HTMLDocument = Ci.nsIDOMHTMLDocument; -let HTMLElement = Ci.nsIDOMHTMLElement; let HTMLHtmlElement = Ci.nsIDOMHTMLHtmlElement; let HTMLBodyElement = Ci.nsIDOMHTMLBodyElement; let HTMLIFrameElement = Ci.nsIDOMHTMLIFrameElement; @@ -346,12 +345,6 @@ let FormAssistant = { break; } - // Only handle the event from our descendants - if (target instanceof HTMLElement && - content.window != target.ownerDocument.defaultView.top) { - break; - } - if (isContentEditable(target)) { this.showKeyboard(this.getTopLevelEditable(target)); this.updateSelection(); From 1bdb2f0cd77dbd218a4db0ec96ec0b30ea1779ca Mon Sep 17 00:00:00 2001 From: Blake Kaplan Date: Mon, 9 Dec 2013 09:59:17 +0800 Subject: [PATCH 16/49] Bug 946437 - Fix cycle collection crash dealing with mobile connection arrays. r=hsinyi --- dom/network/src/MobileConnection.cpp | 4 ++-- dom/network/src/MobileConnectionArray.cpp | 24 +++++++++++++++++++---- dom/network/src/MobileConnectionArray.h | 4 +++- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/dom/network/src/MobileConnection.cpp b/dom/network/src/MobileConnection.cpp index 3bfb07b4ef6..ce77ec4c70b 100644 --- a/dom/network/src/MobileConnection.cpp +++ b/dom/network/src/MobileConnection.cpp @@ -24,7 +24,7 @@ using namespace mozilla::dom::network; -class MobileConnection::Listener : public nsIMobileConnectionListener +class MobileConnection::Listener MOZ_FINAL : public nsIMobileConnectionListener { MobileConnection* mMobileConnection; @@ -692,4 +692,4 @@ MobileConnection::NotifyRadioStateChanged() } return DispatchTrustedEvent(NS_LITERAL_STRING("radiostatechange")); -} \ No newline at end of file +} diff --git a/dom/network/src/MobileConnectionArray.cpp b/dom/network/src/MobileConnectionArray.cpp index bb1c3b54499..110d7658f7a 100644 --- a/dom/network/src/MobileConnectionArray.cpp +++ b/dom/network/src/MobileConnectionArray.cpp @@ -10,9 +10,19 @@ using namespace mozilla::dom::network; -NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_2(MobileConnectionArray, - mWindow, - mMobileConnections) +NS_IMPL_CYCLE_COLLECTION_CLASS(MobileConnectionArray) +NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(MobileConnectionArray) + NS_IMPL_CYCLE_COLLECTION_UNLINK(mWindow) + // Notify our mobile connections that we're going away. + tmp->DropConnections(); + NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER +NS_IMPL_CYCLE_COLLECTION_UNLINK_END +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(MobileConnectionArray) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMobileConnections) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END +NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(MobileConnectionArray) NS_IMPL_CYCLE_COLLECTING_ADDREF(MobileConnectionArray) NS_IMPL_CYCLE_COLLECTING_RELEASE(MobileConnectionArray) @@ -38,6 +48,12 @@ MobileConnectionArray::MobileConnectionArray(nsPIDOMWindow* aWindow) } MobileConnectionArray::~MobileConnectionArray() +{ + DropConnections(); +} + +void +MobileConnectionArray::DropConnections() { for (uint32_t i = 0; i < mMobileConnections.Length(); i++) { mMobileConnections[i]->Shutdown(); @@ -78,4 +94,4 @@ MobileConnectionArray::IndexedGetter(uint32_t aIndex, bool& aFound) const aFound = aIndex < mMobileConnections.Length(); return aFound ? mMobileConnections[aIndex] : nullptr; -} \ No newline at end of file +} diff --git a/dom/network/src/MobileConnectionArray.h b/dom/network/src/MobileConnectionArray.h index a6dc333d52b..9ee1fd5841a 100644 --- a/dom/network/src/MobileConnectionArray.h +++ b/dom/network/src/MobileConnectionArray.h @@ -45,6 +45,8 @@ public: private: ~MobileConnectionArray(); + void DropConnections(); + nsCOMPtr mWindow; nsTArray> mMobileConnections; }; @@ -53,4 +55,4 @@ private: } // namespace dom } // namespace mozilla -#endif // mozilla_dom_network_MobileConnectionArray_h__ \ No newline at end of file +#endif // mozilla_dom_network_MobileConnectionArray_h__ From 51715eb4752d7fbb9feacb28376d0f283b472ad5 Mon Sep 17 00:00:00 2001 From: Randall Barker Date: Sun, 8 Dec 2013 21:42:06 -0500 Subject: [PATCH 17/49] Bug 932295 - Android video capture should autofocus. r=gcp --- .../src/org/webrtc/videoengine/VideoCaptureAndroid.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java b/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java index 13e2f0800fc..8f851131dc9 100644 --- a/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java +++ b/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java @@ -12,6 +12,7 @@ package org.webrtc.videoengine; import java.io.IOException; import java.util.Locale; +import java.util.List; import java.util.concurrent.locks.ReentrantLock; import org.webrtc.videoengine.CaptureCapabilityAndroid; @@ -285,6 +286,12 @@ public class VideoCaptureAndroid implements PreviewCallback, Callback { Camera.Parameters parameters = camera.getParameters(); + + List focusModeList = parameters.getSupportedFocusModes(); + if (focusModeList.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) { + parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO); + } + parameters.setPreviewSize(currentCapability.width, currentCapability.height); parameters.setPreviewFormat(PIXEL_FORMAT); From 7b99f9f6283ff2ac28741cb1c0e983b018640d06 Mon Sep 17 00:00:00 2001 From: Suhas Date: Sun, 8 Dec 2013 21:44:32 -0500 Subject: [PATCH 18/49] Bug 932845 - Support hints for non gUM mediastreams. r=jesup --- content/html/content/src/HTMLMediaElement.cpp | 22 +++++++++++++++++++ .../src/mediapipeline/MediaPipeline.cpp | 8 ++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/content/html/content/src/HTMLMediaElement.cpp b/content/html/content/src/HTMLMediaElement.cpp index ffd45fd7717..f978268dbc9 100644 --- a/content/html/content/src/HTMLMediaElement.cpp +++ b/content/html/content/src/HTMLMediaElement.cpp @@ -1763,7 +1763,29 @@ HTMLMediaElement::CaptureStreamInternal(bool aFinishWhenEnded) } OutputMediaStream* out = mOutputStreams.AppendElement(); +#ifdef DEBUG + // Estimate hints based on the type of the media element + // under the preference media.capturestream_hints for the + // debug builds only. This allows WebRTC Peer Connection + // to behave appropriately when media streams generated + // via mozCaptureStream*() are added to the Peer Connection. + // This functionality is planned to be used as part of Audio + // Quality Performance testing for WebRTC. + // Bug932845: Revisit this once hints mechanism is dealt with + // holistically. + uint8_t hints = 0; + if (Preferences::GetBool("media.capturestream_hints.enabled")) { + nsCOMPtr video = do_QueryObject(this); + if (video && GetVideoFrameContainer()) { + hints = DOMMediaStream::HINT_CONTENTS_VIDEO | DOMMediaStream::HINT_CONTENTS_AUDIO; + } else { + hints = DOMMediaStream::HINT_CONTENTS_AUDIO; + } + } + out->mStream = DOMMediaStream::CreateTrackUnionStream(window, hints); +#else out->mStream = DOMMediaStream::CreateTrackUnionStream(window); +#endif nsRefPtr principal = GetCurrentPrincipal(); out->mStream->CombineWithPrincipal(principal); out->mFinishWhenEnded = aFinishWhenEnded; diff --git a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp index 5e9e93f8f08..400a77519e8 100644 --- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp +++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp @@ -758,9 +758,11 @@ void MediaPipelineTransmit::PipelineListener::ProcessAudioChunk( if (chunk.mBuffer) { switch (chunk.mBufferFormat) { case AUDIO_FORMAT_FLOAT32: - MOZ_MTLOG(ML_ERROR, "Can't process audio except in 16-bit PCM yet"); - MOZ_ASSERT(PR_FALSE); - return; + { + const float* buf = static_cast(chunk.mChannelData[0]); + ConvertAudioSamplesWithScale(buf, static_cast(samples), + chunk.mDuration, chunk.mVolume); + } break; case AUDIO_FORMAT_S16: { From e4800f9a31d81b58030b5d957a552eb2f31c1c89 Mon Sep 17 00:00:00 2001 From: Bevis Tseng Date: Thu, 5 Dec 2013 14:24:31 +0800 Subject: [PATCH 19/49] Bug 946079 - Part 1: Treat Return Call SMS Message as Replaced Type Message instead of MWI message. r=vyang --- .../src/gonk/MobileMessageDatabaseService.js | 8 ++++++-- dom/system/gonk/ril_worker.js | 11 ----------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/dom/mobilemessage/src/gonk/MobileMessageDatabaseService.js b/dom/mobilemessage/src/gonk/MobileMessageDatabaseService.js index b0d623ca347..726749ef3d8 100644 --- a/dom/mobilemessage/src/gonk/MobileMessageDatabaseService.js +++ b/dom/mobilemessage/src/gonk/MobileMessageDatabaseService.js @@ -1619,10 +1619,14 @@ MobileMessageDatabaseService.prototype = { function replaceShortMessageOnSave(aTransaction, aMessageStore, aParticipantStore, aThreadStore, aMessageRecord, aAddresses) { + let isReplaceTypePid = (aMessageRecord.pid) && + ((aMessageRecord.pid >= RIL.PDU_PID_REPLACE_SHORT_MESSAGE_TYPE_1 && + aMessageRecord.pid <= RIL.PDU_PID_REPLACE_SHORT_MESSAGE_TYPE_7) || + aMessageRecord.pid == RIL.PDU_PID_RETURN_CALL_MESSAGE); + if (aMessageRecord.type != "sms" || aMessageRecord.delivery != DELIVERY_RECEIVED || - !(aMessageRecord.pid >= RIL.PDU_PID_REPLACE_SHORT_MESSAGE_TYPE_1 && - aMessageRecord.pid <= RIL.PDU_PID_REPLACE_SHORT_MESSAGE_TYPE_7)) { + !isReplaceTypePid) { this.realSaveRecord(aTransaction, aMessageStore, aParticipantStore, aThreadStore, aMessageRecord, aAddresses); return; diff --git a/dom/system/gonk/ril_worker.js b/dom/system/gonk/ril_worker.js index 6aa7d21aa42..49871103b60 100644 --- a/dom/system/gonk/ril_worker.js +++ b/dom/system/gonk/ril_worker.js @@ -6965,17 +6965,6 @@ let GsmPDUHelper = { case PDU_PID_ANSI_136_R_DATA: case PDU_PID_USIM_DATA_DOWNLOAD: return; - case PDU_PID_RETURN_CALL_MESSAGE: - // Level 1 of message waiting indication: - // Only a return call message is provided - let mwi = msg.mwi = {}; - - // TODO: When should we de-activate the level 1 indicator? - mwi.active = true; - mwi.discard = false; - mwi.msgCount = GECKO_VOICEMAIL_MESSAGE_COUNT_UNKNOWN; - if (DEBUG) debug("TP-PID got return call message: " + msg.sender); - return; } break; } From 9d49a1cb1ddded3b934a1d3f379c12dec6e98aa2 Mon Sep 17 00:00:00 2001 From: Bevis Tseng Date: Thu, 5 Dec 2013 14:26:27 +0800 Subject: [PATCH 20/49] Bug 946079 - Part 2: Modify Test Case to identify Return Call Message as replace Type Message. r=vyang --- .../tests/marionette/test_replace_short_message_type.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom/mobilemessage/tests/marionette/test_replace_short_message_type.js b/dom/mobilemessage/tests/marionette/test_replace_short_message_type.js index b0010d7fe79..e212d1bd943 100644 --- a/dom/mobilemessage/tests/marionette/test_replace_short_message_type.js +++ b/dom/mobilemessage/tests/marionette/test_replace_short_message_type.js @@ -14,7 +14,7 @@ const SENDER_0 = "+1234567890"; const SENDER_1 = "+1234567891"; const PDU_PID_NORMAL = "00"; -const PDU_PIDS = ["00", "41", "42", "43", "44", "45", "46", "47"]; +const PDU_PIDS = ["00", "41", "42", "43", "44", "45", "46", "47", "5F"]; const PDU_DCS_NORMAL = "00"; From 07efca1e187a9d0fd71a2527ff5351fc4e7a9d00 Mon Sep 17 00:00:00 2001 From: Bevis Tseng Date: Thu, 5 Dec 2013 18:39:22 +0800 Subject: [PATCH 21/49] Bug 946079 - Part 3: Remove testLevel1Indicator from test case. r=vyang --- .../test_voicemail_statuschanged.js | 31 +------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/dom/voicemail/test/marionette/test_voicemail_statuschanged.js b/dom/voicemail/test/marionette/test_voicemail_statuschanged.js index efe1ad6ab94..9130400f29b 100644 --- a/dom/voicemail/test/marionette/test_voicemail_statuschanged.js +++ b/dom/voicemail/test/marionette/test_voicemail_statuschanged.js @@ -56,44 +56,15 @@ function isVoicemailStatus(status) { const MWI_PDU_PREFIX = "0000"; const MWI_PDU_UDH_PREFIX = "0040"; const MWI_PID_DEFAULT = "00"; -const MWI_PID_RETURN_CALL_MSG = "5F"; -const MWI_DCS_DATA_MSG = "F0"; const MWI_DCS_DISCARD_INACTIVE = "C0"; const MWI_DCS_DISCARD_ACTIVE = "C8"; const MWI_TIMESTAMP = "00000000000000"; -const MWI_LEVEL1_SENDER = "+15125551234"; -const MWI_LEVEL1_PDU_ADDRESS = PDUBuilder.buildAddress(MWI_LEVEL1_SENDER); const MWI_DEFAULT_BODY = "1 new voicemail"; const MWI_UD_DEFAULT = PDUBuilder.buildUserData({ body: MWI_DEFAULT_BODY }); -// Level 1 Message Waiting is just a return call message -const MWI_LEVEL1_PDU = - MWI_PDU_PREFIX + - MWI_LEVEL1_PDU_ADDRESS + - MWI_PID_RETURN_CALL_MSG + - MWI_DCS_DATA_MSG + - MWI_TIMESTAMP + - MWI_UD_DEFAULT; - -function testLevel1Indicator() { - - function onLevel1Indicator(event) { - let status = event.status; - // TODO: bug 905228 - MozVoicemailStatus is not defined. - //ok(status instanceof MozVoicemailStatus); - is(status.hasMessages, true); - is(status.messageCount, -1); - is(status.returnNumber, MWI_LEVEL1_SENDER); - is(status.returnMessage, MWI_DEFAULT_BODY); - isVoicemailStatus(status); - } - - sendIndicatorPDU(MWI_LEVEL1_PDU, onLevel1Indicator, testLevel2DiscardActive); -} - const MWI_LEVEL2_SENDER = "+15125551235"; const MWI_LEVEL2_PDU_ADDRESS = PDUBuilder.buildAddress(MWI_LEVEL2_SENDER); const MWI_LEVEL2_DISCARD_ACTIVE_PDU = @@ -234,4 +205,4 @@ function cleanUp() { finish(); } -testLevel1Indicator(); +testLevel2DiscardActive(); From 7c06155fecc60f5a5a5658efeff5cc889999af6d Mon Sep 17 00:00:00 2001 From: Bevis Tseng Date: Fri, 6 Dec 2013 11:18:17 +0800 Subject: [PATCH 22/49] Bug 946081 - [B2G][SMS] Store MWI Message Into Message Inbox if MWI is Store Message Type. r=vyang --- dom/system/gonk/RadioInterfaceLayer.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dom/system/gonk/RadioInterfaceLayer.js b/dom/system/gonk/RadioInterfaceLayer.js index 0fb0c9707d1..a885afb12bd 100644 --- a/dom/system/gonk/RadioInterfaceLayer.js +++ b/dom/system/gonk/RadioInterfaceLayer.js @@ -2056,7 +2056,12 @@ RadioInterface.prototype = { mwi.returnMessage = message.fullBody; gMessageManager.sendVoicemailMessage("RIL:VoicemailNotification", this.clientId, mwi); - return true; + + // Dicarded MWI comes without text body. + // Hence, we discard it here after notifying the MWI status. + if (mwi.discard) { + return true; + } } let notifyReceived = function notifyReceived(rv, domMessage) { From 3c46d14f74042d78ac66f990e5aa43fd6cceeae2 Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Mon, 9 Dec 2013 12:21:38 +0000 Subject: [PATCH 23/49] Bug 946517 - Provide MOZ_DISABLE_PROGUARD envvar to disable ProGuard (r=rnewman) --- mobile/android/base/Makefile.in | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mobile/android/base/Makefile.in b/mobile/android/base/Makefile.in index 6d3c90d9408..328b842f161 100644 --- a/mobile/android/base/Makefile.in +++ b/mobile/android/base/Makefile.in @@ -91,10 +91,14 @@ classes.dex: proguard-jars @echo 'DX classes.dex' $(DX) --dex --output=classes.dex jars-proguarded $(ANDROID_COMPAT_LIB) -ifdef MOZ_DEBUG -PROGUARD_PASSES=1 +ifdef MOZ_DISABLE_PROGUARD + PROGUARD_PASSES=0 else -PROGUARD_PASSES=6 + ifdef MOZ_DEBUG + PROGUARD_PASSES=1 + else + PROGUARD_PASSES=6 + endif endif proguard-jars: $(ALL_JARS) From 973a1eb74721f10d9bdbb1a96c8676d4485f4e85 Mon Sep 17 00:00:00 2001 From: Gijs Kruitbosch Date: Mon, 9 Dec 2013 13:29:30 +0100 Subject: [PATCH 24/49] Bug 940387 - when dragging wide items in Australis' palette, don't fix insertion point to first item in row, r=mikedeboer --- browser/components/customizableui/src/DragPositionManager.jsm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser/components/customizableui/src/DragPositionManager.jsm b/browser/components/customizableui/src/DragPositionManager.jsm index 48564bc9ad4..449ab607355 100644 --- a/browser/components/customizableui/src/DragPositionManager.jsm +++ b/browser/components/customizableui/src/DragPositionManager.jsm @@ -101,7 +101,7 @@ AreaPositionManager.prototype = { let doc = aContainer.ownerDocument; let draggedItem = doc.getElementById(aDraggedItemId); // If dragging a wide item, always pick the first item in a row: - if (draggedItem && + if (this._inPanel && draggedItem && draggedItem.classList.contains(CustomizableUI.WIDE_PANEL_CLASS)) { return this._firstInRow(closest); } From d98e1e111a6b12df99055edb2986ded56db4d06d Mon Sep 17 00:00:00 2001 From: Gijs Kruitbosch Date: Mon, 9 Dec 2013 13:30:04 +0100 Subject: [PATCH 25/49] Bug 947867 - fix issues with events in Australis' CustomizableUI discovered when documenting, r=jaws --- .../customizableui/src/CustomizableUI.jsm | 24 ++++++++++++++----- .../src/CustomizableWidgets.jsm | 10 ++++---- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/browser/components/customizableui/src/CustomizableUI.jsm b/browser/components/customizableui/src/CustomizableUI.jsm index dc25448bd7a..6ce79b0c5de 100644 --- a/browser/components/customizableui/src/CustomizableUI.jsm +++ b/browser/components/customizableui/src/CustomizableUI.jsm @@ -477,7 +477,7 @@ let CustomizableUIInternal = { this.insertWidgetBefore(node, currentNode, container, aArea); if (gResetting) { - this.notifyListeners("onWidgetReset", id, aArea); + this.notifyListeners("onWidgetReset", node, container); } } @@ -527,7 +527,7 @@ let CustomizableUIInternal = { } if (gResetting) { - this.notifyListeners("onAreaReset", aArea); + this.notifyListeners("onAreaReset", aArea, container); } } finally { this.endBatchUpdate(); @@ -668,6 +668,8 @@ let CustomizableUIInternal = { } let area = gAreas.get(aArea); + let isToolbar = area.get("type") == CustomizableUI.TYPE_TOOLBAR; + let isOverflowable = isToolbar && area.get("overflowable"); let showInPrivateBrowsing = gPalette.has(aWidgetId) ? gPalette.get(aWidgetId).showInPrivateBrowsing : true; @@ -679,12 +681,15 @@ let CustomizableUIInternal = { continue; } - let container = areaNode.customizationTarget; - let widgetNode = container.ownerDocument.getElementById(aWidgetId); + let widgetNode = window.document.getElementById(aWidgetId); if (!widgetNode) { ERROR("Widget not found, unable to remove"); continue; } + let container = areaNode.customizationTarget; + if (isOverflowable) { + container = areaNode.overflowable.getContainerFor(widgetNode); + } this.notifyListeners("onWidgetBeforeDOMChange", widgetNode, null, container, true); @@ -702,7 +707,7 @@ let CustomizableUIInternal = { } this.notifyListeners("onWidgetAfterDOMChange", widgetNode, null, container, true); - if (area.get("type") == CustomizableUI.TYPE_TOOLBAR) { + if (isToolbar) { areaNode.setAttribute("currentset", gPlacements.get(aArea).join(',')); } @@ -2765,7 +2770,14 @@ OverflowableToolbar.prototype = { return [this._target, null]; } return [this._list, nextNode]; - } + }, + + getContainerFor: function(aNode) { + if (aNode.classList.contains("overflowedItem")) { + return this._list; + } + return this._target; + }, }; // When IDs contain special characters, we need to escape them for use with querySelector: diff --git a/browser/components/customizableui/src/CustomizableWidgets.jsm b/browser/components/customizableui/src/CustomizableWidgets.jsm index 710503bdcbb..466c573f43b 100644 --- a/browser/components/customizableui/src/CustomizableWidgets.jsm +++ b/browser/components/customizableui/src/CustomizableWidgets.jsm @@ -406,8 +406,8 @@ const CustomizableWidgets = [{ updateZoomResetButton(); }.bind(this), - onWidgetReset: function(aWidgetId) { - if (aWidgetId != this.id) + onWidgetReset: function(aWidgetNode) { + if (aWidgetNode != node) return; updateCombinedWidgetStyle(node, this.currentArea, true); updateZoomResetButton(); @@ -506,8 +506,8 @@ const CustomizableWidgets = [{ updateCombinedWidgetStyle(node); }.bind(this), - onWidgetReset: function(aWidgetId) { - if (aWidgetId != this.id) + onWidgetReset: function(aWidgetNode) { + if (aWidgetNode != node) return; updateCombinedWidgetStyle(node, this.currentArea); }.bind(this), @@ -814,4 +814,4 @@ if (isWin8OrHigher()) { }); } #endif -#endif \ No newline at end of file +#endif From e53643de5b42f23d7f0e63c22ddeb1a27ba4b4d0 Mon Sep 17 00:00:00 2001 From: Victor Porof Date: Mon, 9 Dec 2013 18:58:55 +0200 Subject: [PATCH 26/49] Bug 947952 - Rename "non-*" attributes in the Variables View to avoid double negation, r=paul --- .../test/browser_dbg_variables-view-data.js | 8 ++--- .../browser_dbg_variables-view-filter-01.js | 22 ++++++------ .../browser_dbg_variables-view-filter-02.js | 28 +++++++-------- .../browser_dbg_variables-view-filter-03.js | 22 ++++++------ .../browser_dbg_variables-view-filter-05.js | 34 +++++++++---------- .../browser_dbg_variables-view-popup-05.js | 4 +-- .../browser_dbg_variables-view-popup-06.js | 4 +-- .../browser_dbg_variables-view-popup-07.js | 4 +-- .../devtools/shared/widgets/VariablesView.jsm | 8 ++--- browser/devtools/shared/widgets/widgets.css | 6 ++-- browser/themes/linux/devtools/widgets.css | 4 +-- browser/themes/osx/devtools/widgets.css | 4 +-- browser/themes/windows/devtools/widgets.css | 4 +-- 13 files changed, 76 insertions(+), 76 deletions(-) diff --git a/browser/devtools/debugger/test/browser_dbg_variables-view-data.js b/browser/devtools/debugger/test/browser_dbg_variables-view-data.js index d7035c8ea03..2e68772a21a 100644 --- a/browser/devtools/debugger/test/browser_dbg_variables-view-data.js +++ b/browser/devtools/debugger/test/browser_dbg_variables-view-data.js @@ -484,22 +484,22 @@ function testOriginalRawDataIntegrity(arr, obj) { function testAnonymousHeaders(fooScope, anonymousVar, anonymousScope, barVar, bazProperty) { is(fooScope.header, true, "A named scope should have a header visible."); - is(fooScope.target.hasAttribute("non-header"), false, + is(fooScope.target.hasAttribute("untitled"), false, "The non-header attribute should not be applied to scopes with headers."); is(anonymousScope.header, false, "An anonymous scope should have a header visible."); - is(anonymousScope.target.hasAttribute("non-header"), true, + is(anonymousScope.target.hasAttribute("untitled"), true, "The non-header attribute should not be applied to scopes without headers."); is(barVar.header, true, "A named variable should have a header visible."); - is(barVar.target.hasAttribute("non-header"), false, + is(barVar.target.hasAttribute("untitled"), false, "The non-header attribute should not be applied to variables with headers."); is(anonymousVar.header, false, "An anonymous variable should have a header visible."); - is(anonymousVar.target.hasAttribute("non-header"), true, + is(anonymousVar.target.hasAttribute("untitled"), true, "The non-header attribute should not be applied to variables without headers."); } diff --git a/browser/devtools/debugger/test/browser_dbg_variables-view-filter-01.js b/browser/devtools/debugger/test/browser_dbg_variables-view-filter-01.js index 8110042eeac..67ab958f148 100644 --- a/browser/devtools/debugger/test/browser_dbg_variables-view-filter-01.js +++ b/browser/devtools/debugger/test/browser_dbg_variables-view-filter-01.js @@ -72,29 +72,29 @@ function testVariablesAndPropertiesFiltering() { is(constr2Var.expanded, true, "The constr2Var should be expanded."); - is(localScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length, 1, + is(localScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 1, "There should be 1 variable displayed in the local scope."); - is(withScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, + is(withScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 0, "There should be 0 variables displayed in the with scope."); - is(functionScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, + is(functionScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 0, "There should be 0 variables displayed in the function scope."); - isnot(globalScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, + isnot(globalScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 0, "There should be some variables displayed in the global scope."); - is(withScope.target.querySelectorAll(".variables-view-property:not([non-match])").length, 0, + is(withScope.target.querySelectorAll(".variables-view-property:not([unmatched])").length, 0, "There should be 0 properties displayed in the with scope."); - is(functionScope.target.querySelectorAll(".variables-view-property:not([non-match])").length, 0, + is(functionScope.target.querySelectorAll(".variables-view-property:not([unmatched])").length, 0, "There should be 0 properties displayed in the function scope."); - is(globalScope.target.querySelectorAll(".variables-view-property:not([non-match])").length, 0, + is(globalScope.target.querySelectorAll(".variables-view-property:not([unmatched])").length, 0, "There should be 0 properties displayed in the global scope."); - is(localScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"), + is(localScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[0].getAttribute("value"), "__proto__", "The only inner variable displayed should be '__proto__'"); - is(localScope.target.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[0].getAttribute("value"), + is(localScope.target.querySelectorAll(".variables-view-property:not([unmatched]) > .title > .name")[0].getAttribute("value"), "constructor", "The first inner property displayed should be 'constructor'"); - is(localScope.target.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[1].getAttribute("value"), + is(localScope.target.querySelectorAll(".variables-view-property:not([unmatched]) > .title > .name")[1].getAttribute("value"), "__proto__", "The second inner property displayed should be '__proto__'"); - is(localScope.target.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[2].getAttribute("value"), + is(localScope.target.querySelectorAll(".variables-view-property:not([unmatched]) > .title > .name")[2].getAttribute("value"), "constructor", "The third inner property displayed should be 'constructor'"); } diff --git a/browser/devtools/debugger/test/browser_dbg_variables-view-filter-02.js b/browser/devtools/debugger/test/browser_dbg_variables-view-filter-02.js index caae36ed1ef..688bc661d19 100644 --- a/browser/devtools/debugger/test/browser_dbg_variables-view-filter-02.js +++ b/browser/devtools/debugger/test/browser_dbg_variables-view-filter-02.js @@ -72,36 +72,36 @@ function testVariablesAndPropertiesFiltering() { is(constr2Var.expanded, true, "The constr2Var should be expanded."); - is(localScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length, 1, + is(localScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 1, "There should be 1 variable displayed in the local scope."); - is(withScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, + is(withScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 0, "There should be 0 variables displayed in the with scope."); - is(functionScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, + is(functionScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 0, "There should be 0 variables displayed in the function scope."); - is(globalScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, + is(globalScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 0, "There should be no variables displayed in the global scope."); - is(localScope.target.querySelectorAll(".variables-view-property:not([non-match])").length, 4, + is(localScope.target.querySelectorAll(".variables-view-property:not([unmatched])").length, 4, "There should be 4 properties displayed in the local scope."); - is(withScope.target.querySelectorAll(".variables-view-property:not([non-match])").length, 0, + is(withScope.target.querySelectorAll(".variables-view-property:not([unmatched])").length, 0, "There should be 0 properties displayed in the with scope."); - is(functionScope.target.querySelectorAll(".variables-view-property:not([non-match])").length, 0, + is(functionScope.target.querySelectorAll(".variables-view-property:not([unmatched])").length, 0, "There should be 0 properties displayed in the function scope."); - is(globalScope.target.querySelectorAll(".variables-view-property:not([non-match])").length, 0, + is(globalScope.target.querySelectorAll(".variables-view-property:not([unmatched])").length, 0, "There should be 0 properties displayed in the global scope."); - is(localScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"), + is(localScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[0].getAttribute("value"), "__proto__", "The only inner variable displayed should be '__proto__'"); - is(localScope.target.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[0].getAttribute("value"), + is(localScope.target.querySelectorAll(".variables-view-property:not([unmatched]) > .title > .name")[0].getAttribute("value"), "constructor", "The first inner property displayed should be 'constructor'"); - is(localScope.target.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[1].getAttribute("value"), + is(localScope.target.querySelectorAll(".variables-view-property:not([unmatched]) > .title > .name")[1].getAttribute("value"), "__proto__", "The second inner property displayed should be '__proto__'"); - is(localScope.target.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[2].getAttribute("value"), + is(localScope.target.querySelectorAll(".variables-view-property:not([unmatched]) > .title > .name")[2].getAttribute("value"), "constructor", "The third inner property displayed should be 'constructor'"); - is(localScope.target.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[3].getAttribute("value"), + is(localScope.target.querySelectorAll(".variables-view-property:not([unmatched]) > .title > .name")[3].getAttribute("value"), "name", "The fourth inner property displayed should be 'name'"); - is(localScope.target.querySelectorAll(".variables-view-property:not([non-match]) > .title > .value")[3].getAttribute("value"), + is(localScope.target.querySelectorAll(".variables-view-property:not([unmatched]) > .title > .value")[3].getAttribute("value"), "\"Function\"", "The fourth inner property displayed should be '\"Function\"'"); } diff --git a/browser/devtools/debugger/test/browser_dbg_variables-view-filter-03.js b/browser/devtools/debugger/test/browser_dbg_variables-view-filter-03.js index 5014456cadc..a444cc0dfd3 100644 --- a/browser/devtools/debugger/test/browser_dbg_variables-view-filter-03.js +++ b/browser/devtools/debugger/test/browser_dbg_variables-view-filter-03.js @@ -58,20 +58,20 @@ function testVariablesAndPropertiesFiltering() { is(globalScope.expanded, true, "The globalScope should be expanded."); - is(localScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length, 1, + is(localScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 1, "There should be 1 variable displayed in the local scope."); - is(withScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, + is(withScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 0, "There should be 0 variables displayed in the with scope."); - is(functionScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, + is(functionScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 0, "There should be 0 variables displayed in the function scope."); - is(localScope.target.querySelectorAll(".variables-view-property:not([non-match])").length, 0, + is(localScope.target.querySelectorAll(".variables-view-property:not([unmatched])").length, 0, "There should be 0 properties displayed in the local scope."); - is(withScope.target.querySelectorAll(".variables-view-property:not([non-match])").length, 0, + is(withScope.target.querySelectorAll(".variables-view-property:not([unmatched])").length, 0, "There should be 0 properties displayed in the with scope."); - is(functionScope.target.querySelectorAll(".variables-view-property:not([non-match])").length, 0, + is(functionScope.target.querySelectorAll(".variables-view-property:not([unmatched])").length, 0, "There should be 0 properties displayed in the function scope."); - is(globalScope.target.querySelectorAll(".variables-view-property:not([non-match])").length, 0, + is(globalScope.target.querySelectorAll(".variables-view-property:not([unmatched])").length, 0, "There should be 0 properties displayed in the global scope."); } @@ -79,9 +79,9 @@ function testVariablesAndPropertiesFiltering() { typeText(gSearchBox, "*one"); testFiltered("one"); - isnot(globalScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, + isnot(globalScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 0, "There should be some variables displayed in the global scope."); - is(localScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"), + is(localScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[0].getAttribute("value"), "one", "The only inner variable displayed should be 'one'"); } @@ -104,9 +104,9 @@ function testVariablesAndPropertiesFiltering() { typeText(gSearchBox, "*two"); testFiltered("two"); - is(globalScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length, 0, + is(globalScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length, 0, "There should be no variables displayed in the global scope."); - is(localScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"), + is(localScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[0].getAttribute("value"), "two", "The only inner variable displayed should be 'two'"); } diff --git a/browser/devtools/debugger/test/browser_dbg_variables-view-filter-05.js b/browser/devtools/debugger/test/browser_dbg_variables-view-filter-05.js index 22399935ba1..f59d6136afa 100644 --- a/browser/devtools/debugger/test/browser_dbg_variables-view-filter-05.js +++ b/browser/devtools/debugger/test/browser_dbg_variables-view-filter-05.js @@ -58,7 +58,7 @@ function testVariablesAndPropertiesFiltering() { assertScopeExpansion([true, true, true, true]); assertVariablesCountAtLeast([0, 0, 1, 0]); - is(functionScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"), + is(functionScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[0].getAttribute("value"), "arguments", "The arguments pseudoarray should be visible."); is(functionScope.get("arguments").expanded, false, "The arguments pseudoarray in functionScope should not be expanded."); @@ -69,12 +69,12 @@ function testVariablesAndPropertiesFiltering() { assertScopeExpansion([true, true, true, true]); assertVariablesCountAtLeast([0, 0, 1, 1]); - is(functionScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"), + is(functionScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[0].getAttribute("value"), "arguments", "The arguments pseudoarray should be visible."); is(functionScope.get("arguments").expanded, false, "The arguments pseudoarray in functionScope should not be expanded."); - is(globalScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"), + is(globalScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[0].getAttribute("value"), "EventTarget", "The EventTarget object should be visible."); is(globalScope.get("EventTarget").expanded, false, "The EventTarget object in globalScope should not be expanded."); @@ -85,17 +85,17 @@ function testVariablesAndPropertiesFiltering() { assertScopeExpansion([true, true, true, true]); assertVariablesCountAtLeast([0, 1, 3, 1]); - is(functionScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"), + is(functionScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[0].getAttribute("value"), "aNumber", "The aNumber param should be visible."); is(functionScope.get("aNumber").expanded, false, "The aNumber param in functionScope should not be expanded."); - is(functionScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[1].getAttribute("value"), + is(functionScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[1].getAttribute("value"), "a", "The a variable should be visible."); is(functionScope.get("a").expanded, false, "The a variable in functionScope should not be expanded."); - is(functionScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[2].getAttribute("value"), + is(functionScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[2].getAttribute("value"), "arguments", "The arguments pseudoarray should be visible."); is(functionScope.get("arguments").expanded, false, "The arguments pseudoarray in functionScope should not be expanded."); @@ -106,37 +106,37 @@ function testVariablesAndPropertiesFiltering() { assertScopeExpansion([true, true, true, true]); assertVariablesCountAtLeast([4, 1, 3, 1]); - is(localScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"), + is(localScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[0].getAttribute("value"), "this", "The this reference should be visible."); is(localScope.get("this").expanded, false, "The this reference in localScope should not be expanded."); - is(localScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[1].getAttribute("value"), + is(localScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[1].getAttribute("value"), "one", "The one variable should be visible."); is(localScope.get("one").expanded, false, "The one variable in localScope should not be expanded."); - is(localScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[2].getAttribute("value"), + is(localScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[2].getAttribute("value"), "two", "The two variable should be visible."); is(localScope.get("two").expanded, false, "The two variable in localScope should not be expanded."); - is(localScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[3].getAttribute("value"), + is(localScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[3].getAttribute("value"), "__proto__", "The __proto__ reference should be visible."); is(localScope.get("__proto__").expanded, false, "The __proto__ reference in localScope should not be expanded."); - is(functionScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"), + is(functionScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[0].getAttribute("value"), "aNumber", "The aNumber param should be visible."); is(functionScope.get("aNumber").expanded, false, "The aNumber param in functionScope should not be expanded."); - is(functionScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[1].getAttribute("value"), + is(functionScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[1].getAttribute("value"), "a", "The a variable should be visible."); is(functionScope.get("a").expanded, false, "The a variable in functionScope should not be expanded."); - is(functionScope.target.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[2].getAttribute("value"), + is(functionScope.target.querySelectorAll(".variables-view-variable:not([unmatched]) > .title > .name")[2].getAttribute("value"), "arguments", "The arguments pseudoarray should be visible."); is(functionScope.get("arguments").expanded, false, "The arguments pseudoarray in functionScope should not be expanded."); @@ -162,19 +162,19 @@ function testVariablesAndPropertiesFiltering() { } function assertVariablesCountAtLeast(aCounts) { - ok(localScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length >= aCounts[0], + ok(localScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length >= aCounts[0], "There should be " + aCounts[0] + " variable displayed in the local scope (" + step + ")."); - ok(withScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length >= aCounts[1], + ok(withScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length >= aCounts[1], "There should be " + aCounts[1] + " variable displayed in the with scope (" + step + ")."); - ok(functionScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length >= aCounts[2], + ok(functionScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length >= aCounts[2], "There should be " + aCounts[2] + " variable displayed in the function scope (" + step + ")."); - ok(globalScope.target.querySelectorAll(".variables-view-variable:not([non-match])").length >= aCounts[3], + ok(globalScope.target.querySelectorAll(".variables-view-variable:not([unmatched])").length >= aCounts[3], "There should be " + aCounts[3] + " variable displayed in the global scope (" + step + ")."); diff --git a/browser/devtools/debugger/test/browser_dbg_variables-view-popup-05.js b/browser/devtools/debugger/test/browser_dbg_variables-view-popup-05.js index d8a3bce872b..654a8c49b32 100644 --- a/browser/devtools/debugger/test/browser_dbg_variables-view-popup-05.js +++ b/browser/devtools/debugger/test/browser_dbg_variables-view-popup-05.js @@ -19,9 +19,9 @@ function test() { is(tooltip.querySelectorAll(".variables-view-container").length, 1, "There should be one variables view container added to the tooltip."); - is(tooltip.querySelectorAll(".variables-view-scope[non-header]").length, 1, + is(tooltip.querySelectorAll(".variables-view-scope[untitled]").length, 1, "There should be one scope with no header displayed."); - is(tooltip.querySelectorAll(".variables-view-variable[non-header]").length, 1, + is(tooltip.querySelectorAll(".variables-view-variable[untitled]").length, 1, "There should be one variable with no header displayed."); is(tooltip.querySelectorAll(".variables-view-property").length, 2, diff --git a/browser/devtools/debugger/test/browser_dbg_variables-view-popup-06.js b/browser/devtools/debugger/test/browser_dbg_variables-view-popup-06.js index 106682a72ba..5b355be708a 100644 --- a/browser/devtools/debugger/test/browser_dbg_variables-view-popup-06.js +++ b/browser/devtools/debugger/test/browser_dbg_variables-view-popup-06.js @@ -19,9 +19,9 @@ function test() { is(tooltip.querySelectorAll(".variables-view-container").length, 1, "There should be one variables view container added to the tooltip."); - is(tooltip.querySelectorAll(".variables-view-scope[non-header]").length, 1, + is(tooltip.querySelectorAll(".variables-view-scope[untitled]").length, 1, "There should be one scope with no header displayed."); - is(tooltip.querySelectorAll(".variables-view-variable[non-header]").length, 1, + is(tooltip.querySelectorAll(".variables-view-variable[untitled]").length, 1, "There should be one variable with no header displayed."); is(tooltip.querySelectorAll(".variables-view-property").length, 7, diff --git a/browser/devtools/debugger/test/browser_dbg_variables-view-popup-07.js b/browser/devtools/debugger/test/browser_dbg_variables-view-popup-07.js index 81ce289e782..06539677bf9 100644 --- a/browser/devtools/debugger/test/browser_dbg_variables-view-popup-07.js +++ b/browser/devtools/debugger/test/browser_dbg_variables-view-popup-07.js @@ -33,9 +33,9 @@ function test() { is(tooltip.querySelectorAll(".devtools-tooltip-simple-text").length, 0, "There should be no simple text node added to the tooltip."); - is(tooltip.querySelectorAll(".variables-view-scope[non-header]").length, 1, + is(tooltip.querySelectorAll(".variables-view-scope[untitled]").length, 1, "There should be one scope with no header displayed."); - is(tooltip.querySelectorAll(".variables-view-variable[non-header]").length, 1, + is(tooltip.querySelectorAll(".variables-view-variable[untitled]").length, 1, "There should be one variable with no header displayed."); ok(tooltip.querySelectorAll(".variables-view-property").length >= propertyCount, diff --git a/browser/devtools/shared/widgets/VariablesView.jsm b/browser/devtools/shared/widgets/VariablesView.jsm index e3b1defe96f..dca2211f1ef 100644 --- a/browser/devtools/shared/widgets/VariablesView.jsm +++ b/browser/devtools/shared/widgets/VariablesView.jsm @@ -1476,7 +1476,7 @@ Scope.prototype = { if (this._isHeaderVisible || !this._nameString) { return; } - this._target.removeAttribute("non-header"); + this._target.removeAttribute("untitled"); this._isHeaderVisible = true; }, @@ -1489,7 +1489,7 @@ Scope.prototype = { return; } this.expand(); - this._target.setAttribute("non-header", ""); + this._target.setAttribute("untitled", ""); this._isHeaderVisible = false; }, @@ -1928,10 +1928,10 @@ Scope.prototype = { } if (aStatus) { this._isMatch = true; - this.target.removeAttribute("non-match"); + this.target.removeAttribute("unmatched"); } else { this._isMatch = false; - this.target.setAttribute("non-match", ""); + this.target.setAttribute("unmatched", ""); } }, diff --git a/browser/devtools/shared/widgets/widgets.css b/browser/devtools/shared/widgets/widgets.css index 339602d9e6b..60f34d20cee 100644 --- a/browser/devtools/shared/widgets/widgets.css +++ b/browser/devtools/shared/widgets/widgets.css @@ -50,9 +50,9 @@ overflow: hidden; } -.variables-view-scope[non-header] > .title, -.variable-or-property[non-header] > .title, -.variable-or-property[non-match] > .title { +.variables-view-scope[untitled] > .title, +.variable-or-property[untitled] > .title, +.variable-or-property[unmatched] > .title { display: none; } diff --git a/browser/themes/linux/devtools/widgets.css b/browser/themes/linux/devtools/widgets.css index 6fc0da0ac44..26827a1decd 100644 --- a/browser/themes/linux/devtools/widgets.css +++ b/browser/themes/linux/devtools/widgets.css @@ -467,7 +467,7 @@ cursor: text; } -.variable-or-property:not([non-header]) > .variables-view-element-details { +.variable-or-property:not([untitled]) > .variables-view-element-details { -moz-margin-start: 10px; } @@ -632,7 +632,7 @@ min-height: 24px; } -.variable-or-property[non-match] { +.variable-or-property[unmatched] { border: none; margin: 0; } diff --git a/browser/themes/osx/devtools/widgets.css b/browser/themes/osx/devtools/widgets.css index 30ec9aa34c0..f6a4782d1fb 100644 --- a/browser/themes/osx/devtools/widgets.css +++ b/browser/themes/osx/devtools/widgets.css @@ -461,7 +461,7 @@ cursor: text; } -.variable-or-property:not([non-header]) > .variables-view-element-details { +.variable-or-property:not([untitled]) > .variables-view-element-details { -moz-margin-start: 10px; } @@ -626,7 +626,7 @@ min-height: 24px; } -.variable-or-property[non-match] { +.variable-or-property[unmatched] { border: none; margin: 0; } diff --git a/browser/themes/windows/devtools/widgets.css b/browser/themes/windows/devtools/widgets.css index 7966cd69332..98710e553fb 100644 --- a/browser/themes/windows/devtools/widgets.css +++ b/browser/themes/windows/devtools/widgets.css @@ -464,7 +464,7 @@ cursor: text; } -.variable-or-property:not([non-header]) > .variables-view-element-details { +.variable-or-property:not([untitled]) > .variables-view-element-details { -moz-margin-start: 10px; } @@ -629,7 +629,7 @@ min-height: 24px; } -.variable-or-property[non-match] { +.variable-or-property[unmatched] { border: none; margin: 0; } From ab39990106bb182f250e5648a4559cb9cb5c8a20 Mon Sep 17 00:00:00 2001 From: Margaret Leibovic Date: Mon, 9 Dec 2013 09:05:59 -0800 Subject: [PATCH 27/49] Bug 941357 - (Part 1) Consolidate per-profile content provider logic in PerProfileDatabases, starting with TabsProvider. r=rnewman --- .../android/base/db/PerProfileDatabases.java | 69 ++++++++++++++++++ mobile/android/base/db/TabsProvider.java | 73 ++++--------------- mobile/android/base/moz.build | 1 + 3 files changed, 85 insertions(+), 58 deletions(-) create mode 100644 mobile/android/base/db/PerProfileDatabases.java diff --git a/mobile/android/base/db/PerProfileDatabases.java b/mobile/android/base/db/PerProfileDatabases.java new file mode 100644 index 00000000000..ad7aba19ead --- /dev/null +++ b/mobile/android/base/db/PerProfileDatabases.java @@ -0,0 +1,69 @@ +/* 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/. */ + +package org.mozilla.gecko.db; + +import java.io.File; +import java.util.HashMap; + +import org.mozilla.gecko.GeckoProfile; + +import android.content.Context; +import android.database.sqlite.SQLiteOpenHelper; +import android.text.TextUtils; + +/** + * Manages a set of per-profile database storage helpers. + */ +public class PerProfileDatabases { + + private final HashMap mStorages = new HashMap(); + + private final Context mContext; + private final String mDatabaseName; + private final DatabaseHelperFactory mHelperFactory; + + public interface DatabaseHelperFactory { + public T makeDatabaseHelper(Context context, String databasePath); + } + + public PerProfileDatabases(final Context context, final String databaseName, final DatabaseHelperFactory helperFactory) { + mContext = context; + mDatabaseName = databaseName; + mHelperFactory = helperFactory; + } + + public String getDatabasePathForProfile(String profile) { + final File profileDir = GeckoProfile.get(mContext, profile).getDir(); + if (profileDir == null) { + return null; + } + + return new File(profileDir, mDatabaseName).getAbsolutePath(); + } + + public T getDatabaseHelperForProfile(String profile) { + // Always fall back to default profile if none has been provided. + if (TextUtils.isEmpty(profile)) { + profile = GeckoProfile.get(mContext).getName(); + } + + synchronized (this) { + if (mStorages.containsKey(profile)) { + return mStorages.get(profile); + } + + final String databasePath = getDatabasePathForProfile(profile); + if (databasePath == null) { + throw new IllegalStateException("Database path is null for profile: " + profile); + } + + final T helper = mHelperFactory.makeDatabaseHelper(mContext, databasePath); + DBUtils.ensureDatabaseIsNotLocked(helper, databasePath); + + mStorages.put(profile, helper); + return helper; + } + } +} diff --git a/mobile/android/base/db/TabsProvider.java b/mobile/android/base/db/TabsProvider.java index 8a2ecd28a5b..3e0ff721801 100644 --- a/mobile/android/base/db/TabsProvider.java +++ b/mobile/android/base/db/TabsProvider.java @@ -12,6 +12,7 @@ import java.util.Map; import org.mozilla.gecko.GeckoProfile; import org.mozilla.gecko.db.BrowserContract.Clients; import org.mozilla.gecko.db.BrowserContract.Tabs; +import org.mozilla.gecko.db.PerProfileDatabases.DatabaseHelperFactory; import org.mozilla.gecko.mozglue.RobocopTarget; import android.content.ContentProvider; @@ -33,6 +34,8 @@ public class TabsProvider extends ContentProvider { private static final String LOGTAG = "GeckoTabsProvider"; private Context mContext; + private PerProfileDatabases mDatabases; + static final String DATABASE_NAME = "tabs.db"; static final int DATABASE_VERSION = 2; @@ -85,8 +88,6 @@ public class TabsProvider extends ContentProvider { CLIENTS_PROJECTION_MAP = Collections.unmodifiableMap(map); } - private HashMap mDatabasePerProfile; - static final String selectColumn(String table, String column) { return table + "." + column + " = ?"; } @@ -107,8 +108,8 @@ public class TabsProvider extends ContentProvider { } } - final class DatabaseHelper extends SQLiteOpenHelper { - public DatabaseHelper(Context context, String databasePath) { + final class TabsDatabaseHelper extends SQLiteOpenHelper { + public TabsDatabaseHelper(Context context, String databasePath) { super(context, databasePath, null, DATABASE_VERSION); } @@ -207,59 +208,9 @@ public class TabsProvider extends ContentProvider { } } - private DatabaseHelper getDatabaseHelperForProfile(String profile) { - // Each profile has a separate tabs.db database. The target - // profile is provided using a URI query argument in each request - // to our content provider. - - // Always fallback to default profile if none has been provided. - if (TextUtils.isEmpty(profile)) { - profile = GeckoProfile.get(getContext()).getName(); - } - - DatabaseHelper dbHelper; - synchronized (this) { - dbHelper = mDatabasePerProfile.get(profile); - if (dbHelper != null) { - return dbHelper; - } - - String databasePath = getDatabasePath(profile); - - // Before bug 768532, the database was located outside if the - // profile on Android 2.2. Make sure it is moved inside the profile - // directory. - if (Build.VERSION.SDK_INT == 8) { - File oldPath = mContext.getDatabasePath("tabs-" + profile + ".db"); - if (oldPath.exists()) { - oldPath.renameTo(new File(databasePath)); - } - } - - dbHelper = new DatabaseHelper(getContext(), databasePath); - mDatabasePerProfile.put(profile, dbHelper); - - DBUtils.ensureDatabaseIsNotLocked(dbHelper, databasePath); - } - - debug("Created database helper for profile: " + profile); - return dbHelper; - } - @RobocopTarget private String getDatabasePath(String profile) { - trace("Getting database path for profile: " + profile); - - File profileDir = GeckoProfile.get(mContext, profile).getDir(); - if (profileDir == null) { - debug("Couldn't find directory for profile: " + profile); - return null; - } - - String databasePath = new File(profileDir, DATABASE_NAME).getAbsolutePath(); - debug("Successfully created database path for profile: " + databasePath); - - return databasePath; + return mDatabases.getDatabasePathForProfile(profile); } private SQLiteDatabase getReadableDatabase(Uri uri) { @@ -270,7 +221,7 @@ public class TabsProvider extends ContentProvider { if (uri != null) profile = uri.getQueryParameter(BrowserContract.PARAM_PROFILE); - return getDatabaseHelperForProfile(profile).getReadableDatabase(); + return mDatabases.getDatabaseHelperForProfile(profile).getReadableDatabase(); } private SQLiteDatabase getWritableDatabase(Uri uri) { @@ -281,7 +232,7 @@ public class TabsProvider extends ContentProvider { if (uri != null) profile = uri.getQueryParameter(BrowserContract.PARAM_PROFILE); - return getDatabaseHelperForProfile(profile).getWritableDatabase(); + return mDatabases.getDatabaseHelperForProfile(profile).getWritableDatabase(); } @Override @@ -290,7 +241,13 @@ public class TabsProvider extends ContentProvider { synchronized (this) { mContext = getContext(); - mDatabasePerProfile = new HashMap(); + mDatabases = new PerProfileDatabases( + getContext(), DATABASE_NAME, new DatabaseHelperFactory() { + @Override + public TabsDatabaseHelper makeDatabaseHelper(Context context, String databasePath) { + return new TabsDatabaseHelper(context, databasePath); + } + }); } return true; diff --git a/mobile/android/base/moz.build b/mobile/android/base/moz.build index 456051266d9..a55d5391cc2 100644 --- a/mobile/android/base/moz.build +++ b/mobile/android/base/moz.build @@ -117,6 +117,7 @@ gbjar.sources += [ 'db/LocalBrowserDB.java', 'db/PasswordsProvider.java', 'db/PerProfileContentProvider.java', + 'db/PerProfileDatabases.java', 'db/TabsProvider.java', 'Distribution.java', 'DoorHanger.java', From 803715f1baad7b6d3a650642d79033cc347524f2 Mon Sep 17 00:00:00 2001 From: Margaret Leibovic Date: Mon, 9 Dec 2013 09:06:02 -0800 Subject: [PATCH 28/49] Bug 941357 - (Part 2) Update BrowserProvider to use PerProfileDatases. r=rnewman --- mobile/android/base/db/BrowserProvider.java | 77 ++++--------------- .../android/base/db/PerProfileDatabases.java | 14 +++- 2 files changed, 28 insertions(+), 63 deletions(-) diff --git a/mobile/android/base/db/BrowserProvider.java b/mobile/android/base/db/BrowserProvider.java index 11708a6a022..589125d29ae 100644 --- a/mobile/android/base/db/BrowserProvider.java +++ b/mobile/android/base/db/BrowserProvider.java @@ -19,6 +19,7 @@ import org.mozilla.gecko.db.BrowserContract.Schema; import org.mozilla.gecko.db.BrowserContract.SyncColumns; import org.mozilla.gecko.db.BrowserContract.Thumbnails; import org.mozilla.gecko.db.BrowserContract.URLColumns; +import org.mozilla.gecko.db.PerProfileDatabases.DatabaseHelperFactory; import org.mozilla.gecko.gfx.BitmapUtils; import org.mozilla.gecko.mozglue.RobocopTarget; import org.mozilla.gecko.sync.Utils; @@ -67,6 +68,8 @@ public class BrowserProvider extends ContentProvider { private static final String LOGTAG = "GeckoBrowserProvider"; private Context mContext; + private PerProfileDatabases mDatabases; + static final String DATABASE_NAME = "browser.db"; static final int DATABASE_VERSION = 17; @@ -313,8 +316,6 @@ public class BrowserProvider extends ContentProvider { SEARCH_SUGGEST_PROJECTION_MAP = Collections.unmodifiableMap(map); } - private HashMap mDatabasePerProfile; - private interface BookmarkMigrator { public void updateForNewTable(ContentValues bookmark); } @@ -364,8 +365,8 @@ public class BrowserProvider extends ContentProvider { } } - final class DatabaseHelper extends SQLiteOpenHelper { - public DatabaseHelper(Context context, String databasePath) { + final class BrowserDatabaseHelper extends SQLiteOpenHelper { + public BrowserDatabaseHelper(Context context, String databasePath) { super(context, databasePath, null, DATABASE_VERSION); } @@ -1953,63 +1954,9 @@ public class BrowserProvider extends ContentProvider { } } - private DatabaseHelper getDatabaseHelperForProfile(String profile, boolean isTest) { - // Each profile has a separate browser.db database. The target - // profile is provided using a URI query argument in each request - // to our content provider. - - // Always fallback to default profile if none has been provided. - if (TextUtils.isEmpty(profile)) { - profile = GeckoProfile.get(mContext).getName(); - } - - DatabaseHelper dbHelper; - synchronized (this) { - dbHelper = mDatabasePerProfile.get(profile); - if (dbHelper != null) { - return dbHelper; - } - - String databasePath = getDatabasePath(profile, isTest); - - // Before bug 768532, the database was located outside if the - // profile on Android 2.2. Make sure it is moved inside the profile - // directory. - if (Build.VERSION.SDK_INT == 8) { - File oldPath = mContext.getDatabasePath("browser-" + profile + ".db"); - if (oldPath.exists()) { - oldPath.renameTo(new File(databasePath)); - } - } - - dbHelper = new DatabaseHelper(getContext(), databasePath); - mDatabasePerProfile.put(profile, dbHelper); - - DBUtils.ensureDatabaseIsNotLocked(dbHelper, databasePath); - } - - debug("Created database helper for profile: " + profile); - return dbHelper; - } - @RobocopTarget public String getDatabasePath(String profile, boolean isTest) { - trace("Getting database path for profile: " + profile); - - if (isTest) { - return DATABASE_NAME; - } - - File profileDir = GeckoProfile.get(mContext, profile).getDir(); - if (profileDir == null) { - debug("Couldn't find directory for profile: " + profile); - return null; - } - - String databasePath = new File(profileDir, DATABASE_NAME).getAbsolutePath(); - debug("Successfully created database path for profile: " + databasePath); - - return databasePath; + return mDatabases.getDatabasePathForProfile(profile, isTest); } private SQLiteDatabase getReadableDatabase(Uri uri) { @@ -2020,7 +1967,7 @@ public class BrowserProvider extends ContentProvider { if (uri != null) profile = uri.getQueryParameter(BrowserContract.PARAM_PROFILE); - return getDatabaseHelperForProfile(profile, isTest(uri)).getReadableDatabase(); + return mDatabases.getDatabaseHelperForProfile(profile, isTest(uri)).getReadableDatabase(); } private SQLiteDatabase getWritableDatabase(Uri uri) { @@ -2031,7 +1978,7 @@ public class BrowserProvider extends ContentProvider { if (uri != null) profile = uri.getQueryParameter(BrowserContract.PARAM_PROFILE); - return getDatabaseHelperForProfile(profile, isTest(uri)).getWritableDatabase(); + return mDatabases.getDatabaseHelperForProfile(profile, isTest(uri)).getWritableDatabase(); } private void cleanupSomeDeletedRecords(Uri fromUri, Uri targetUri, String tableName) { @@ -2178,7 +2125,13 @@ public class BrowserProvider extends ContentProvider { synchronized (this) { mContext = getContext(); - mDatabasePerProfile = new HashMap(); + mDatabases = new PerProfileDatabases( + getContext(), DATABASE_NAME, new DatabaseHelperFactory() { + @Override + public BrowserDatabaseHelper makeDatabaseHelper(Context context, String databasePath) { + return new BrowserDatabaseHelper(context, databasePath); + } + }); } return true; diff --git a/mobile/android/base/db/PerProfileDatabases.java b/mobile/android/base/db/PerProfileDatabases.java index ad7aba19ead..6d81c57f9d7 100644 --- a/mobile/android/base/db/PerProfileDatabases.java +++ b/mobile/android/base/db/PerProfileDatabases.java @@ -35,6 +35,14 @@ public class PerProfileDatabases { } public String getDatabasePathForProfile(String profile) { + return getDatabasePathForProfile(profile, false); + } + + public String getDatabasePathForProfile(String profile, boolean isTest) { + if (isTest) { + return mDatabaseName; + } + final File profileDir = GeckoProfile.get(mContext, profile).getDir(); if (profileDir == null) { return null; @@ -44,6 +52,10 @@ public class PerProfileDatabases { } public T getDatabaseHelperForProfile(String profile) { + return getDatabaseHelperForProfile(profile, false); + } + + public T getDatabaseHelperForProfile(String profile, boolean isTest) { // Always fall back to default profile if none has been provided. if (TextUtils.isEmpty(profile)) { profile = GeckoProfile.get(mContext).getName(); @@ -54,7 +66,7 @@ public class PerProfileDatabases { return mStorages.get(profile); } - final String databasePath = getDatabasePathForProfile(profile); + final String databasePath = getDatabasePathForProfile(profile, isTest); if (databasePath == null) { throw new IllegalStateException("Database path is null for profile: " + profile); } From 6acae2d328e2a959a2c21e6c77a6656b3552762a Mon Sep 17 00:00:00 2001 From: Gijs Kruitbosch Date: Mon, 9 Dec 2013 18:46:23 +0100 Subject: [PATCH 29/49] Bug 942393 - document Australis' CustomizableUI, r=me, comments-only, NPOTB, DONTBUILD --HG-- extra : rebase_source : 6e90cbf47609670ae3ee9e7a85ed1791fccee299 --- .../customizableui/src/CustomizableUI.jsm | 283 ++++++++++++++++++ 1 file changed, 283 insertions(+) diff --git a/browser/components/customizableui/src/CustomizableUI.jsm b/browser/components/customizableui/src/CustomizableUI.jsm index 6ce79b0c5de..bd352bbb4ef 100644 --- a/browser/components/customizableui/src/CustomizableUI.jsm +++ b/browser/components/customizableui/src/CustomizableUI.jsm @@ -2099,47 +2099,330 @@ this.CustomizableUI = { get WIDE_PANEL_CLASS() "panel-wide-item", get PANEL_COLUMN_COUNT() 3, + /** + * Add a listener object that will get fired for various events regarding + * customization. + * + * @param aListener the listener object to add + * + * Not all event handler methods need to be defined. + * CustomizableUI will catch exceptions. Events are dispatched + * synchronously on the UI thread, so if you can delay any/some of your + * processing, that is advisable. The following event handlers are supported: + * - onWidgetAdded(aWidgetId, aArea, aPosition) + * Fired when a widget is added to an area. aWidgetId is the widget that + * was added, aArea the area it was added to, and aPosition the position + * in which it was added. + * - onWidgetMoved(aWidgetId, aArea, aOldPosition, aNewPosition) + * Fired when a widget is moved within its area. aWidgetId is the widget + * that was moved, aArea the area it was moved in, aOldPosition its old + * position, and aNewPosition its new position. + * - onWidgetRemoved(aWidgetId, aArea) + * Fired when a widget is removed from its area. aWidgetId is the widget + * that was removed, aArea the area it was removed from. + * + * - onWidgetBeforeDOMChange(aNode, aNextNode, aContainer, aIsRemoval) + * Fired *before* a widget's DOM node is acted upon by CustomizableUI + * (to add, move or remove it). aNode is the DOM node changed, aNextNode + * the DOM node (if any) before which a widget will be inserted, + * aContainer the *actual* DOM container (could be an overflow panel in + * case of an overflowable toolbar), and aWasRemoval is true iff the + * action about to happen is the removal of the DOM node. + * - onWidgetAfterDOMChange(aNode, aNextNode, aContainer, aWasRemoval) + * Like onWidgetBeforeDOMChange, but fired after the change to the DOM + * node of the widget. + * + * - onWidgetReset(aNode, aContainer) + * Fired after a reset to default placements moves a widget's node to a + * different location. aNode is the widget's node, aContainer is the + * area it was moved into (NB: it might already have been there and been + * moved to a different position!) + * - onAreaReset(aArea, aContainer) + * Fired after a reset to default placements is complete on an area's + * DOM node. Note that this is fired for each DOM node. aArea is the area + * that was reset, aContainer the DOM node that was reset. + * + * - onWidgetCreated(aWidgetId) + * Fired when a widget with id aWidgetId has been created, but before it + * is added to any placements or any DOM nodes have been constructed. + * Only fired for API-based widgets. + * - onWidgetAfterCreation(aWidgetId, aArea) + * Fired after a widget with id aWidgetId has been created, and has been + * added to either its default area or the area in which it was placed + * previously. If the widget has no default area and/or it has never + * been placed anywhere, aArea may be null. Only fired for API-based + * widgets. + * - onWidgetDestroyed(aWidgetId) + * Fired when widgets are destroyed. aWidgetId is the widget that is + * being destroyed. Only fired for API-based widgets. + * - onWidgetInstanceRemoved(aWidgetId, aDocument) + * Fired when a window is unloaded and a widget's instance is destroyed + * because of this. Only fired for API-based widgets. + * + * - onWidgetDrag(aWidgetId, aArea) + * Fired both when and after customize mode drag handling system tries + * to determine the width and height of widget aWidgetId when dragged to a + * different area. aArea will be the area the item is dragged to, or + * undefined after the measurements have been done and the node has been + * moved back to its 'regular' area. + * + * - onCustomizeStart(aWindow) + * Fired when opening customize mode in aWindow. + * - onCustomizeEnd(aWindow) + * Fired when exiting customize mode in aWindow. + */ addListener: function(aListener) { CustomizableUIInternal.addListener(aListener); }, + /** + * Remove a listener added with addListener + * @param aListener the listener object to remove + */ removeListener: function(aListener) { CustomizableUIInternal.removeListener(aListener); }, + + /** + * Register a customizable area with CustomizableUI. + * @param aName the name of the area to register. Can only contain + * alphanumeric characters, dashes (-) and underscores (_). + * @param aProps the properties of the area. The following properties are + * recognized: + * - type: the type of area. Either TYPE_TOOLBAR (default) or + * TYPE_MENU_PANEL; + * - anchor: for a menu panel or overflowable toolbar, the + * anchoring node for the panel. + * - legacy: set to true if you want customizableui to + * automatically migrate the currentset attribute + * - overflowable: set to true if your toolbar is overflowable. + * This requires an anchor, and only has an + * effect for toolbars. + * - defaultPlacements: an array of widget IDs making up the + * default contents of the area + */ registerArea: function(aName, aProperties) { CustomizableUIInternal.registerArea(aName, aProperties); }, + /** + * Register a concrete node for a registered area. This method is automatically + * called from any toolbar in the main browser window that has its + * "customizable" attribute set to true. There should normally be no need to + * call it yourself. + * + * Note that ideally, you should register your toolbar using registerArea + * before any of the toolbars have their XBL bindings constructed (which + * will happen when they're added to the DOM and are not hidden). If you + * don't, and your toolbar has a defaultset attribute, CustomizableUI will + * register it automatically. If your toolbar does not have a defaultset + * attribute, the node will be saved for processing when you call + * registerArea. Note that CustomizableUI won't restore state in the area, + * allow the user to customize it in customize mode, or otherwise deal + * with it, until the area has been registered. + */ registerToolbarNode: function(aToolbar, aExistingChildren) { CustomizableUIInternal.registerToolbarNode(aToolbar, aExistingChildren); }, + /** + * Register the menu panel node. This method should not be called by anyone + * apart from the built-in PanelUI. + * @param aPanel the panel DOM node being registered. + */ registerMenuPanel: function(aPanel) { CustomizableUIInternal.registerMenuPanel(aPanel); }, + /** + * Unregister a customizable area. The inverse of registerArea. + * + * Unregistering an area will remove all the (removable) widgets in the + * area, which will return to the panel, and destroy all other traces + * of the area within CustomizableUI. Note that this means the *contents* + * of the area's DOM nodes will be moved to the panel or removed, but + * the area's DOM nodes *themselves* will stay. + * + * Furthermore, by default the placements of the area will be kept in the + * saved state (!) and restored if you re-register the area at a later + * point. This is useful for e.g. add-ons that get disabled and then + * re-enabled (e.g. when they update). + * + * You can override this last behaviour (and destroy the placements + * information in the saved state) by passing true for aDestroyPlacements. + * + * @param aName the name of the area to unregister + * @param aDestroyPlacements whether to destroy the placements information + * for the area, too. + */ unregisterArea: function(aName, aDestroyPlacements) { CustomizableUIInternal.unregisterArea(aName, aDestroyPlacements); }, + /** + * Add a widget to an area. + * If the area to which you try to add is not known to CustomizableUI, + * this will throw. + * If the area to which you try to add has not yet been restored from its + * legacy state, this will postpone the addition. + * If the area to which you try to add is the same as the area in which + * the widget is currently placed, this will do the same as + * moveWidgetWithinArea. + * If the widget cannot be removed from its original location, this will + * no-op. + * + * This will fire an onWidgetAdded notification, + * and an onWidgetBeforeDOMChange and onWidgetAfterDOMChange notification + * for each window CustomizableUI knows about. + * + * @param aWidgetId the widget to add + * @param aArea the area to add the widget to + * @param aPosition the position at which to add the widget. If you do not + * pass a position, the widget will be added to the end + * of the area. + */ addWidgetToArea: function(aWidgetId, aArea, aPosition) { CustomizableUIInternal.addWidgetToArea(aWidgetId, aArea, aPosition); }, + /** + * Remove a widget from its area. If the widget cannot be removed from its + * area, or is not in any area, this will no-op. Otherwise, this will fire an + * onWidgetRemoved notification, and an onWidgetBeforeDOMChange and + * onWidgetAfterDOMChange notification for each window CustomizableUI knows + * about. + * + * @param aWidgetId the widget to remove + */ removeWidgetFromArea: function(aWidgetId) { CustomizableUIInternal.removeWidgetFromArea(aWidgetId); }, + /** + * Move a widget within an area. + * If the widget is not in any area, this will no-op. + * If the widget is already at the indicated position, this will no-op. + * + * Otherwise, this will move the widget and fire an onWidgetMoved notification, + * and an onWidgetBeforeDOMChange and onWidgetAfterDOMChange notification for + * each window CustomizableUI knows about. + * + * @param aWidgetid the widget to move + * @param aPosition the position to move the widget to. + * Negative values or values greater than the number of + * widgets will be interpreted to mean moving the widget to + * respectively the first or last position. + */ moveWidgetWithinArea: function(aWidgetId, aPosition) { CustomizableUIInternal.moveWidgetWithinArea(aWidgetId, aPosition); }, + /** + * Ensure a XUL-based widget created in a window after areas were + * initialized moves to its correct position. + * This is roughly equivalent to manually looking up the position and using + * insertItem in the old API, but a lot less work for consumers. + * Always prefer this over using toolbar.insertItem (which might no-op + * because it delegates to addWidgetToArea) or, worse, moving items in the + * DOM yourself. + * + * @param aWidgetId the widget that was just created + * @param aWindow the window in which you want to ensure it was added. + * + * NB: why is this API per-window, you wonder? Because if you need this, + * presumably you yourself need to create the widget in all the windows + * and need to loop through them anyway. + */ ensureWidgetPlacedInWindow: function(aWidgetId, aWindow) { return CustomizableUIInternal.ensureWidgetPlacedInWindow(aWidgetId, aWindow); }, + /** + * Start a batch update of items. + * During a batch update, the customization state is not saved to the user's + * preferences file, in order to reduce (possibly sync) IO. + * Calls to begin/endBatchUpdate may be nested. + * + * Callers should ensure that NO MATTER WHAT they call endBatchUpdate once + * for each call to endBatchUpdate, even if there are exceptions in the + * code in the batch update. Otherwise, for the duration of the + * Firefox session, customization state is never saved. Typically, you + * would do this using a try...finally block. + */ beginBatchUpdate: function() { CustomizableUIInternal.beginBatchUpdate(); }, + /** + * End a batch update. See the documentation for beginBatchUpdate above. + * + * State is not saved if we believe it is identical to the last known + * saved state. State is only ever saved when all batch updates have + * finished (ie there has been 1 endBatchUpdate call for each + * beginBatchUpdate call). If any of the endBatchUpdate calls pass + * aForceDirty=true, we will flush to the prefs file. + * + * @param aForceDirty force CustomizableUI to flush to the prefs file when + * all batch updates have finished. + */ endBatchUpdate: function(aForceDirty) { CustomizableUIInternal.endBatchUpdate(aForceDirty); }, + /** + * Create a widget. + * + * To create a widget, you should pass an object with its desired + * properties. The following properties are supported: + * + * - id: the ID of the widget (required). + * - type: a string indicating the type of widget. Possible types + * are: + * 'button' - for simple button widgets (the default) + * 'view' - for buttons that open a panel or subview, + * depending on where they are placed. + * 'custom' - for fine-grained control over the creation + * of the widget. + * - viewId: Only useful for views (and required there): the id of the + * that should be shown when clicking the widget. + * - onBuild(aDoc): Only useful for custom widgets (and required there); a + * function that will be invoked with the document in which + * to build a widget. Should return the DOM node that has + * been constructed. + * - onCreated(aNode): Attached to all widgets; a function that will be invoked + * whenever the widget has a DOM node constructed, passing the + * constructed node as an argument. + * - onCommand(aEvt): Only useful for button widgets; a function that will be + * invoked when the user activates the button. + * - onClick(aEvt): Attached to all widgets; a function that will be invoked + * when the user clicks the widget. + * - onViewShowing(aEvt): Only useful for views; a function that will be + * invoked when a user shows your view. + * - onViewHiding(aEvt): Only useful for views; a function that will be + * invoked when a user hides your view. + * - tooltiptext: string to use for the tooltip of the widget + * - label: string to use for the label of the widget + * - removable: whether the widget is removable (optional, default: false) + * - overflows: whether widget can overflow when in an overflowable + * toolbar (optional, default: true) + * - defaultArea: default area to add the widget to + * (optional, default: none) + * - shortcutId: id of an element that has a shortcut for this widget + * (optional, default: null). This is only used to display + * the shortcut as part of the tooltip for builtin widgets + * (which have strings inside + * customizableWidgets.properties). If you're in an add-on, + * you should not set this property. + * - showInPrivateBrowsing: whether to show the widget in private browsing + * mode (optional, default: true) + * + * @param aProperties the specifications for the widget. + */ createWidget: function(aProperties) { return CustomizableUIInternal.wrapWidget( CustomizableUIInternal.createWidget(aProperties) ); }, + /** + * Destroy a widget + * + * If the widget is part of the default placements in an area, this will + * remove it from there. It will also remove any DOM instances. However, + * it will keep the widget in the placements for whatever area it was + * in at the time. You can remove it from there yourself by calling + * CustomizableUI.removeWidgetFromArea(aWidgetId). + * + * @param aWidgetId the widget to destroy + */ destroyWidget: function(aWidgetId) { CustomizableUIInternal.destroyWidget(aWidgetId); }, From 6ba2a1c8b4eb5004b58b9b940629920a386249b9 Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Mon, 9 Dec 2013 10:20:56 -0800 Subject: [PATCH 30/49] Bug 946335 - Scrollbar on Metro start page is covered by navbar [r=emtwo] --- browser/metro/base/content/browser-ui.js | 10 +++++++++- browser/metro/base/content/browser.js | 11 ++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/browser/metro/base/content/browser-ui.js b/browser/metro/base/content/browser-ui.js index 1fc03d48734..abf604de47f 100644 --- a/browser/metro/base/content/browser-ui.js +++ b/browser/metro/base/content/browser-ui.js @@ -308,10 +308,11 @@ var BrowserUI = { isStartURI: function isStartURI(aURI) { aURI = aURI || Browser.selectedBrowser.currentURI.spec; - return aURI == kStartURI; + return aURI == kStartURI || aURI == "about:home"; }, updateStartURIAttributes: function (aURI) { + let wasStart = Elements.windowState.hasAttribute("startpage"); aURI = aURI || Browser.selectedBrowser.currentURI.spec; if (this.isStartURI(aURI)) { ContextUI.displayNavbar(); @@ -319,6 +320,13 @@ var BrowserUI = { } else if (aURI != "about:blank") { // about:blank is loaded briefly for new tabs; ignore it Elements.windowState.removeAttribute("startpage"); } + + let isStart = Elements.windowState.hasAttribute("startpage"); + if (wasStart != isStart) { + let event = document.createEvent("Events"); + event.initEvent("StartUIChange", true, true); + Browser.selectedBrowser.dispatchEvent(event); + } }, getDisplayURI: function(browser) { diff --git a/browser/metro/base/content/browser.js b/browser/metro/base/content/browser.js index 658c3529e56..073302c581e 100644 --- a/browser/metro/base/content/browser.js +++ b/browser/metro/base/content/browser.js @@ -1305,6 +1305,7 @@ Tab.prototype = { } browser.addEventListener("pageshow", onPageShowEvent, true); browser.addEventListener("DOMWindowCreated", this, false); + browser.addEventListener("StartUIChange", this, false); Elements.browsers.addEventListener("SizeChanged", this, false); browser.messageManager.addMessageListener("Content:StateChange", this); @@ -1316,12 +1317,19 @@ Tab.prototype = { updateViewport: function (aEvent) { // is not yet supported; just use the browser size. - this.browser.setWindowSize(this.browser.clientWidth, this.browser.clientHeight); + let browser = this.browser; + + // On the start page we add padding to keep the browser above the navbar. + let paddingBottom = parseInt(getComputedStyle(browser).paddingBottom, 10); + let height = browser.clientHeight - paddingBottom; + + browser.setWindowSize(browser.clientWidth, height); }, handleEvent: function (aEvent) { switch (aEvent.type) { case "DOMWindowCreated": + case "StartUIChange": this.updateViewport(); break; case "SizeChanged": @@ -1354,6 +1362,7 @@ Tab.prototype = { destroy: function destroy() { this._browser.messageManager.removeMessageListener("Content:StateChange", this); this._browser.removeEventListener("DOMWindowCreated", this, false); + this._browser.removeEventListener("StartUIChange", this, false); Elements.browsers.removeEventListener("SizeChanged", this, false); clearTimeout(this._updateThumbnailTimeout); From b48f853fb68ac98fe4f76cd2da1647deab8a4be6 Mon Sep 17 00:00:00 2001 From: Rodrigo Silveira Date: Mon, 9 Dec 2013 10:41:58 -0800 Subject: [PATCH 31/49] Bug 944255 - about:start bookmarks and history tiles cut off when using split views r=sfoster --HG-- extra : rebase_source : d1e2a8636ba863d89fbcb658ce373cddceb722b2 --- browser/metro/modules/View.jsm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/browser/metro/modules/View.jsm b/browser/metro/modules/View.jsm index d2e77185658..cd60b89181f 100644 --- a/browser/metro/modules/View.jsm +++ b/browser/metro/modules/View.jsm @@ -27,18 +27,18 @@ function makeURI(aURL, aOriginCharset, aBaseURI) { function View(aSet) { this._set = aSet; this._set.controller = this; + this._window = aSet.ownerDocument.defaultView; + + this.onResize = () => this._adjustDOMforViewState(); + this._window.addEventListener("resize", this.onResize); - this.viewStateObserver = { - observe: (aSubject, aTopic, aData) => this._adjustDOMforViewState(aData) - }; - Services.obs.addObserver(this.viewStateObserver, "metro_viewstate_changed", false); ColorUtils.init(); this._adjustDOMforViewState(); } View.prototype = { destruct: function () { - Services.obs.removeObserver(this.viewStateObserver, "metro_viewstate_changed"); + this._window.removeEventListener("resize", this.onResize); }, _adjustDOMforViewState: function _adjustDOMforViewState(aState) { From 2bfcffdc085e80e59c5155af4774cfaa8279cff0 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Fri, 6 Dec 2013 14:49:17 -0600 Subject: [PATCH 32/49] Bug 947406 - Don't return promise when done with package upload. r=ochameau --- toolkit/devtools/server/actors/webapps.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toolkit/devtools/server/actors/webapps.js b/toolkit/devtools/server/actors/webapps.js index d9853529a78..75ac0d390fa 100644 --- a/toolkit/devtools/server/actors/webapps.js +++ b/toolkit/devtools/server/actors/webapps.js @@ -72,7 +72,8 @@ PackageUploadActor.prototype = { * and also be locked. */ done: function (aRequest) { - return this._file.close(); + this._file.close(); + return {}; }, /** @@ -81,7 +82,6 @@ PackageUploadActor.prototype = { */ remove: function (aRequest) { this._cleanupFile(); - return {}; }, From 06b4a0987545a3f04760f49393d32ab4fc8ddc34 Mon Sep 17 00:00:00 2001 From: Brian Grinstead Date: Sun, 8 Dec 2013 09:56:37 -0600 Subject: [PATCH 33/49] Bug 947708 - RTL support for toolbox tabs, fix up small UI regressions from Bug 941579;r=vporof --- .../themes/shared/devtools/toolbars.inc.css | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/browser/themes/shared/devtools/toolbars.inc.css b/browser/themes/shared/devtools/toolbars.inc.css index e015592a8d6..aca52970aab 100644 --- a/browser/themes/shared/devtools/toolbars.inc.css +++ b/browser/themes/shared/devtools/toolbars.inc.css @@ -488,16 +488,16 @@ color: #b6babf; margin: 0; padding: 0; - border-left: 1px solid #42484f; + -moz-border-start: 1px solid #42484f; -moz-box-align: center; } .devtools-tab:first-child { - border-left-width: 0; + -moz-border-start-width: 0; } .devtools-tab:last-child { - border-right: 1px solid #5a6169; + -moz-border-end: 1px solid #42484f; } .devtools-tab > image { @@ -522,7 +522,7 @@ } .devtools-tab:active > image, -.devtools-tab[selected=true] > label { +.devtools-tab[selected=true] > image { opacity: 1; } @@ -546,12 +546,16 @@ } .devtools-tab[selected=true]:not(:first-child) { - padding-left: 1px; + -moz-padding-start: 1px; +} + +.devtools-tab[selected=true]:last-child { + -moz-padding-end: 1px; } .devtools-tab[selected=true] + .devtools-tab { - border-left-width: 0; - padding-left: 1px; + -moz-border-start-width: 0; + -moz-padding-start: 1px; } .devtools-tab:not([selected=true]).highlighted { From 095399401b4d2b00ab89ca2012adb2aff79685a2 Mon Sep 17 00:00:00 2001 From: Sam Foster Date: Sun, 8 Dec 2013 10:51:11 -0800 Subject: [PATCH 34/49] Bug 936897 - Move download-progress notifications before a tab closes. r=mbrubeck --- browser/metro/base/content/downloads.js | 130 ++++++++++++++++++------ 1 file changed, 97 insertions(+), 33 deletions(-) diff --git a/browser/metro/base/content/downloads.js b/browser/metro/base/content/downloads.js index 05ec75da7a3..c181d01f430 100644 --- a/browser/metro/base/content/downloads.js +++ b/browser/metro/base/content/downloads.js @@ -18,8 +18,7 @@ var MetroDownloadsView = { _inited: false, _progressAlert: null, _lastSec: Infinity, - _notificationBox: null, - _progressNotification: null, + _progressNotificationInfo: new Map(), _runDownloadBooleanMap: new Map(), @@ -56,11 +55,12 @@ var MetroDownloadsView = { Services.obs.addObserver(this, "dl-run", true); Services.obs.addObserver(this, "dl-failed", true); - this._notificationBox = Browser.getNotificationBox(); this._progress = new DownloadProgressListener(this); this.manager.addListener(this._progress); + Elements.tabList.addEventListener("TabClose", this, false); + this._downloadProgressIndicator = document.getElementById("download-progress"); if (this.manager.activeDownloadCount) { @@ -74,10 +74,54 @@ var MetroDownloadsView = { Services.obs.removeObserver(this, "dl-done"); Services.obs.removeObserver(this, "dl-run"); Services.obs.removeObserver(this, "dl-failed"); + if (Elements && Elements.tabList) + Elements.tabList.removeEventListener("TabClose", this); } }, - _restartWithActiveDownloads: function() { + get _notificationBox() { + return Browser.getNotificationBox(Browser.selectedBrowser); + }, + + get _notificationBoxes() { + let currentBox = this._notificationBox; + let boxes = [ + currentBox + ]; + for (let { linkedBrowser } of Elements.tabList.children) { + if (linkedBrowser !== Browser.selectedBrowser) { + let notificationBox = Browser.getNotificationBox(linkedBrowser); + if (notificationBox) + boxes.push(notificationBox); + } + } + return boxes; + }, + + get _progressNotification() { + let notn = this._getNotificationWithValue("download-progress"); + let currentBox = this._notificationBox; + // move the progress notification if attached to a different browser + if (notn && notn.parentNode !== currentBox) { + notn.parentNode.removeNotification(notn); + currentBox.insertBefore(notn, currentBox.firstChild); + } + return notn; + }, + + _getNotificationWithValue: function(aValue) { + let notn; + let allNotificationBoxes = this._notificationBoxes; + for(let box of allNotificationBoxes) { + notn = box.getNotificationWithValue(aValue); + if (notn) { + break; + } + } + return notn; + }, + + _restartWithActiveDownloads: function() { let activeDownloads = this.manager.activeDownloads; while (activeDownloads.hasMoreElements()) { @@ -140,9 +184,9 @@ var MetroDownloadsView = { this._runDownloadBooleanMap.delete(aDownload.targetFile.path); this._downloadCount--; this._downloadsInProgress--; - if (this._downloadsInProgress <= 0) { - this._notificationBox.removeNotification(this._progressNotification); - this._progressNotification = null; + let notn = this._progressNotification; + if (notn && this._downloadsInProgress <= 0) { + this._notificationBox.removeNotification(notn); } } catch (ex) { Util.dumpLn("Failed to cancel download, with id: "+aDownload.id+", download target URI spec: " + fileURI.spec); @@ -384,32 +428,35 @@ var MetroDownloadsView = { }, onDownloadButton: function dv_onDownloadButton() { - if (this._downloadsInProgress) { - if (!this._removeNotification("download-progress")) { - this.updateInfobar(); - } - } else if (this._downloadCount) { - if (!this._removeNotification("download-complete")) { - this._showDownloadCompleteNotification(); - } + let progressNotification = this._getNotificationWithValue("download-progress"); + let wasProgressVisible = (progressNotification && + progressNotification.parentNode == this._notificationBox); + let completeNotification = this._getNotificationWithValue("download-complete"); + let wasCompleteVisible = (completeNotification && + completeNotification.parentNode == this._notificationBox); + + this._removeNotification("download-complete"); + this._removeNotification("download-progress"); + + if (this._downloadsInProgress && !wasProgressVisible) { + this.updateInfobar(); + } else if (this._downloadCount && !wasCompleteVisible) { + this._showDownloadCompleteNotification(); } }, _removeNotification: function (aValue) { - let notification = this._notificationBox.getNotificationWithValue(aValue); - if (!notification) { - return false; - } - this._notificationBox.removeNotification(notification); - return true; + let notification = this._getNotificationWithValue(aValue); + return notification && + notification.parentNode.removeNotification(notification); }, updateInfobar: function dv_updateInfobar() { let message = this._computeDownloadProgressString(); this._updateCircularProgressMeter(); - if (this._progressNotification == null || - !this._notificationBox.getNotificationWithValue("download-progress")) { + let notn = this._progressNotification; + if (!notn) { let cancelButtonText = Strings.browser.GetStringFromName("downloadCancel"); @@ -425,23 +472,23 @@ var MetroDownloadsView = { } ]; - this._progressNotification = - this.showNotification("download-progress", message, buttons, - this._notificationBox.PRIORITY_WARNING_LOW); + notn = this.showNotification("download-progress", message, buttons, + this._notificationBox.PRIORITY_WARNING_LOW); ContextUI.displayNavbar(); } else { - this._progressNotification.label = message; + notn.label = message; } }, updateDownload: function dv_updateDownload(aDownload) { - if (this._progressNotification != null) { - this._saveDownloadData(aDownload); - this._progressNotification.label = + this._saveDownloadData(aDownload); + let notn = this._progressNotification; + if (notn) { + notn.label = this._computeDownloadProgressString(aDownload); - this._updateCircularProgressMeter(); } + this._updateCircularProgressMeter(); }, watchDownload: function dv_watchDownload(aDownload) { @@ -486,8 +533,9 @@ var MetroDownloadsView = { this._showDownloadCompleteToast(); this._showDownloadCompleteNotification(); } - this._notificationBox.removeNotification(this._progressNotification); - this._progressNotification = null; + let notn = this._progressNotification; + if (notn) + this._notificationBox.removeNotification(notn); } break; case "dl-failed": @@ -497,6 +545,22 @@ var MetroDownloadsView = { } }, + handleEvent: function(aEvent) { + switch (aEvent.type) { + case 'TabClose': { + let browser = aEvent.originalTarget.linkedBrowser; + dump("DownloadNotificationsView handleEvent, got TabClose event for browser: "+browser+"\n"); + let notn = this._getNotificationWithValue("download-progress"); + if (notn && notn.defaultView == browser.contentWindow) { + let nextTab = Browser.getNextTab(aEvent.originalTarget); + let box = Browser.getNotificationBox(nextTab.linkedBrowser); + box.insertBefore(notn, box.firstChild); + } + break; + } + } + }, + QueryInterface: function (aIID) { if (!aIID.equals(Ci.nsIObserver) && !aIID.equals(Ci.nsISupportsWeakReference) && From f597ff0757e8ac73b11516480c238cbcf33f0766 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Mon, 9 Dec 2013 13:27:58 +0900 Subject: [PATCH 35/49] Bug 946175 - Make all sandbox variables default to an instance of their class type. r=gps --- python/mozbuild/mozbuild/frontend/data.py | 4 +- python/mozbuild/mozbuild/frontend/sandbox.py | 42 +++-- .../mozbuild/frontend/sandbox_symbols.py | 167 +++++++++--------- python/mozbuild/mozbuild/sphinx.py | 3 +- .../test/frontend/test_sandbox_symbols.py | 2 +- 5 files changed, 119 insertions(+), 99 deletions(-) diff --git a/python/mozbuild/mozbuild/frontend/data.py b/python/mozbuild/mozbuild/frontend/data.py index 9983c13081c..dfa16a0a0df 100644 --- a/python/mozbuild/mozbuild/frontend/data.py +++ b/python/mozbuild/mozbuild/frontend/data.py @@ -24,7 +24,7 @@ from mozbuild.util import ( shell_quote, StrictOrderingOnAppendList, ) -from .sandbox_symbols import compute_final_target +from .sandbox_symbols import FinalTargetValue class TreeMetadata(object): @@ -499,6 +499,6 @@ class InstallationTarget(SandboxDerived): """Returns whether or not the target is not derived from the default given xpiname and subdir.""" - return compute_final_target(dict( + return FinalTargetValue(dict( XPI_NAME=self.xpiname, DIST_SUBDIR=self.subdir)) == self.target diff --git a/python/mozbuild/mozbuild/frontend/sandbox.py b/python/mozbuild/mozbuild/frontend/sandbox.py index ed754797f98..ffdb7fd904a 100644 --- a/python/mozbuild/mozbuild/frontend/sandbox.py +++ b/python/mozbuild/mozbuild/frontend/sandbox.py @@ -34,6 +34,12 @@ from mozbuild.util import ( ) +class SandboxDerivedValue(object): + """Classes deriving from this one receive a special treatment in a + sandbox GlobalNamespace. See GlobalNamespace documentation. + """ + + def alphabetical_sorted(iterable, cmp=None, key=lambda x: x.lower(), reverse=False): """sorted() replacement for the sandbox, ordering alphabetically by @@ -61,10 +67,17 @@ class GlobalNamespace(dict): When variables are read, we first try to read the existing value. If a value is not found and it is defined in the allowed variables set, we - return the default value for it. We don't assign default values until - they are accessed because this makes debugging the end-result much - simpler. Instead of a data structure with lots of empty/default values, - you have a data structure with only the values that were read or touched. + return a new instance of the class for that variable. We don't assign + default instances until they are accessed because this makes debugging + the end-result much simpler. Instead of a data structure with lots of + empty/default values, you have a data structure with only the values + that were read or touched. + + Instances of variables classes are created by invoking class_name(), + except when class_name derives from SandboxDerivedValue, in which + case class_name(instance_of_the_global_namespace) is invoked. + A value is added to those calls when instances are created during + assignment (setitem). Instantiators of this class are given a backdoor to perform setting of arbitrary values. e.g. @@ -126,11 +139,13 @@ class GlobalNamespace(dict): # If the default is specifically a lambda (or, rather, any function--but # not a class that can be called), then it is actually a rule to # generate the default that should be used. - default_rule = default[2] - if isinstance(default_rule, type(lambda: None)): - default_rule = default_rule(self) + default = default[0] + if issubclass(default, SandboxDerivedValue): + value = default(self) + else: + value = default() - dict.__setitem__(self, name, copy.deepcopy(default_rule)) + dict.__setitem__(self, name, value) return dict.__getitem__(self, name) def __setitem__(self, name, value): @@ -140,8 +155,8 @@ class GlobalNamespace(dict): # We don't need to check for name.isupper() here because LocalNamespace # only sends variables our way if isupper() is True. - stored_type, input_type, default, docs, tier = \ - self._allowed_variables.get(name, (None, None, None, None, None)) + stored_type, input_type, docs, tier = \ + self._allowed_variables.get(name, (None, None, None, None)) # Variable is unknown. if stored_type is None: @@ -160,7 +175,10 @@ class GlobalNamespace(dict): value, input_type) raise self.last_name_error - value = stored_type(value) + if issubclass(stored_type, SandboxDerivedValue): + value = stored_type(self, value) + else: + value = stored_type(value) dict.__setitem__(self, name, value) @@ -382,6 +400,6 @@ class Sandbox(object): return self._globals.get(key, default) def get_affected_tiers(self): - tiers = (self._allowed_variables[key][4] for key in self + tiers = (self._allowed_variables[key][3] for key in self if key in self._allowed_variables) return set(tier for tier in tiers if tier) diff --git a/python/mozbuild/mozbuild/frontend/sandbox_symbols.py b/python/mozbuild/mozbuild/frontend/sandbox_symbols.py index 0e4ba0db314..cba94004a64 100644 --- a/python/mozbuild/mozbuild/frontend/sandbox_symbols.py +++ b/python/mozbuild/mozbuild/frontend/sandbox_symbols.py @@ -22,25 +22,28 @@ from mozbuild.util import ( HierarchicalStringList, StrictOrderingOnAppendList, ) +from .sandbox import SandboxDerivedValue +from types import StringTypes + + +class FinalTargetValue(SandboxDerivedValue, unicode): + def __new__(cls, sandbox, value=""): + if not value: + value = 'dist/' + if sandbox['XPI_NAME']: + value += 'xpi-stage/' + sandbox['XPI_NAME'] + else: + value += 'bin' + if sandbox['DIST_SUBDIR']: + value += '/' + sandbox['DIST_SUBDIR'] + return unicode.__new__(cls, value) -def compute_final_target(variables): - """Convert the default value for FINAL_TARGET""" - basedir = 'dist/' - if variables['XPI_NAME']: - basedir += 'xpi-stage/' + variables['XPI_NAME'] - else: - basedir += 'bin' - if variables['DIST_SUBDIR']: - basedir += '/' + variables['DIST_SUBDIR'] - return basedir - - # This defines the set of mutable global variables. # # Each variable is a tuple of: # -# (storage_type, input_types, default_value, docs, tier) +# (storage_type, input_types, docs, tier) # # Tier says for which specific tier the variable has an effect. # Valid tiers are: @@ -55,7 +58,7 @@ def compute_final_target(variables): VARIABLES = { # Variables controlling reading of other frontend files. - 'ANDROID_GENERATED_RESFILES': (StrictOrderingOnAppendList, list, [], + 'ANDROID_GENERATED_RESFILES': (StrictOrderingOnAppendList, list, """Android resource files generated as part of the build. This variable contains a list of files that are expected to be @@ -64,33 +67,33 @@ VARIABLES = { file. """, 'export'), - 'ANDROID_RESFILES': (StrictOrderingOnAppendList, list, [], + 'ANDROID_RESFILES': (StrictOrderingOnAppendList, list, """Android resource files. This variable contains a list of files to package into a 'res' directory and merge into an APK file. """, 'export'), - 'SOURCES': (StrictOrderingOnAppendList, list, [], + 'SOURCES': (StrictOrderingOnAppendList, list, """Source code files. This variable contains a list of source code files to compile. Accepts assembler, C, C++, Objective C/C++. """, 'compile'), - 'GENERATED_SOURCES': (StrictOrderingOnAppendList, list, [], + 'GENERATED_SOURCES': (StrictOrderingOnAppendList, list, """Generated source code files. This variable contains a list of generated source code files to compile. Accepts assembler, C, C++, Objective C/C++. """, 'compile'), - 'FILES_PER_UNIFIED_FILE': (int, int, None, + 'FILES_PER_UNIFIED_FILE': (int, int, """The number of source files to compile into each unified source file. """, 'None'), - 'UNIFIED_SOURCES': (StrictOrderingOnAppendList, list, [], + 'UNIFIED_SOURCES': (StrictOrderingOnAppendList, list, """Source code files that can be compiled together. This variable contains a list of source code files to compile, @@ -99,7 +102,7 @@ VARIABLES = { size. """, 'compile'), - 'GENERATED_UNIFIED_SOURCES': (StrictOrderingOnAppendList, list, [], + 'GENERATED_UNIFIED_SOURCES': (StrictOrderingOnAppendList, list, """Generated source code files that can be compiled together. This variable contains a list of generated source code files to @@ -108,7 +111,7 @@ VARIABLES = { and reduce the debug info size. """, 'compile'), - 'GENERATED_FILES': (StrictOrderingOnAppendList, list, [], + 'GENERATED_FILES': (StrictOrderingOnAppendList, list, """Generic generated files. This variable contains a list of generate files for the build system @@ -116,7 +119,7 @@ VARIABLES = { Makefile.in. """, 'export'), - 'DEFINES': (OrderedDict, dict, OrderedDict(), + 'DEFINES': (OrderedDict, dict, """Dictionary of compiler defines to declare. These are passed in to the compiler as ``-Dkey='value'`` for string @@ -144,7 +147,7 @@ VARIABLES = { }) """, None), - 'DIRS': (list, list, [], + 'DIRS': (list, list, """Child directories to descend into looking for build frontend files. This works similarly to the ``DIRS`` variable in make files. Each str @@ -158,18 +161,18 @@ VARIABLES = { delimiters. """, None), - 'EXPORT_LIBRARY': (bool, bool, False, + 'EXPORT_LIBRARY': (bool, bool, """Install the library to the static libraries folder. """, None), - 'EXTRA_COMPONENTS': (StrictOrderingOnAppendList, list, [], + 'EXTRA_COMPONENTS': (StrictOrderingOnAppendList, list, """Additional component files to distribute. This variable contains a list of files to copy into ``$(FINAL_TARGET)/components/``. """, 'libs'), - 'EXTRA_JS_MODULES': (StrictOrderingOnAppendList, list, [], + 'EXTRA_JS_MODULES': (StrictOrderingOnAppendList, list, """Additional JavaScript files to distribute. This variable contains a list of files to copy into @@ -177,7 +180,7 @@ VARIABLES = { to ``modules`` if left undefined. """, 'libs'), - 'EXTRA_PP_JS_MODULES': (StrictOrderingOnAppendList, list, [], + 'EXTRA_PP_JS_MODULES': (StrictOrderingOnAppendList, list, """Additional JavaScript files to distribute. This variable contains a list of files to copy into @@ -185,14 +188,14 @@ VARIABLES = { ``JS_MODULES_PATH`` defaults to ``modules`` if left undefined. """, 'libs'), - 'EXTRA_PP_COMPONENTS': (StrictOrderingOnAppendList, list, [], + 'EXTRA_PP_COMPONENTS': (StrictOrderingOnAppendList, list, """Javascript XPCOM files. This variable contains a list of files to preprocess. Generated files will be installed in the ``/components`` directory of the distribution. """, 'libs'), - 'FINAL_LIBRARY': (unicode, unicode, "", + 'FINAL_LIBRARY': (unicode, unicode, """Library in which the objects of the current directory will be linked. This variable contains the name of a library, defined elsewhere with @@ -200,42 +203,42 @@ VARIABLES = { linked. """, 'binaries'), - 'CPP_UNIT_TESTS': (StrictOrderingOnAppendList, list, [], + 'CPP_UNIT_TESTS': (StrictOrderingOnAppendList, list, """C++ source files for unit tests. This is a list of C++ unit test sources. Entries must be files that exist. These generally have ``.cpp`` extensions. """, 'binaries'), - 'FAIL_ON_WARNINGS': (bool, bool, False, + 'FAIL_ON_WARNINGS': (bool, bool, """Whether to treat warnings as errors. """, None), - 'FORCE_SHARED_LIB': (bool, bool, False, + 'FORCE_SHARED_LIB': (bool, bool, """Whether the library in this directory is a shared library. """, None), - 'FORCE_STATIC_LIB': (bool, bool, False, + 'FORCE_STATIC_LIB': (bool, bool, """Whether the library in this directory is a static library. """, None), - 'GENERATED_INCLUDES' : (StrictOrderingOnAppendList, list, [], + 'GENERATED_INCLUDES' : (StrictOrderingOnAppendList, list, """Directories generated by the build system to be searched for include files by the compiler. """, None), - 'HOST_SOURCES': (StrictOrderingOnAppendList, list, [], + 'HOST_SOURCES': (StrictOrderingOnAppendList, list, """Source code files to compile with the host compiler. This variable contains a list of source code files to compile. with the host compiler. """, 'compile'), - 'IS_COMPONENT': (bool, bool, False, + 'IS_COMPONENT': (bool, bool, """Whether the library contains a binary XPCOM component manifest. """, None), - 'PARALLEL_DIRS': (list, list, [], + 'PARALLEL_DIRS': (list, list, """A parallel version of ``DIRS``. Ideally this variable does not exist. It is provided so a transition @@ -244,18 +247,18 @@ VARIABLES = { likely go away. """, None), - 'HOST_LIBRARY_NAME': (unicode, unicode, "", + 'HOST_LIBRARY_NAME': (unicode, unicode, """Name of target library generated when cross compiling. """, 'binaries'), - 'JAVA_JAR_TARGETS': (dict, dict, {}, + 'JAVA_JAR_TARGETS': (dict, dict, """Defines Java JAR targets to be built. This variable should not be populated directly. Instead, it should populated by calling add_java_jar(). """, 'binaries'), - 'JS_MODULES_PATH': (unicode, unicode, "", + 'JS_MODULES_PATH': (unicode, unicode, """Sub-directory of ``$(FINAL_TARGET)`` to install ``EXTRA_JS_MODULES``. @@ -265,7 +268,7 @@ VARIABLES = { ``$(FINAL_TARGET)/modules``. """, None), - 'LIBRARY_NAME': (unicode, unicode, "", + 'LIBRARY_NAME': (unicode, unicode, """The name of the library generated for a directory. In ``example/components/moz.build``,:: @@ -276,44 +279,44 @@ VARIABLES = { ``example/components/xpcomsample.lib`` on Windows. """, 'binaries'), - 'LIBS': (StrictOrderingOnAppendList, list, [], + 'LIBS': (StrictOrderingOnAppendList, list, """Linker libraries and flags. A list of libraries and flags to include when linking. """, None), - 'LIBXUL_LIBRARY': (bool, bool, False, + 'LIBXUL_LIBRARY': (bool, bool, """Whether the library in this directory is linked into libxul. Implies ``MOZILLA_INTERNAL_API`` and ``FORCE_STATIC_LIB``. """, None), - 'LOCAL_INCLUDES': (StrictOrderingOnAppendList, list, [], + 'LOCAL_INCLUDES': (StrictOrderingOnAppendList, list, """Additional directories to be searched for include files by the compiler. """, None), - 'MSVC_ENABLE_PGO': (bool, bool, False, + 'MSVC_ENABLE_PGO': (bool, bool, """Whether profile-guided optimization is enabled in this directory. """, None), - 'NO_VISIBILITY_FLAGS': (bool, bool, False, + 'NO_VISIBILITY_FLAGS': (bool, bool, """Build sources listed in this file without VISIBILITY_FLAGS. """, None), - 'OS_LIBS': (list, list, [], + 'OS_LIBS': (list, list, """System link libraries. This variable contains a list of system libaries to link against. """, None), - 'SDK_LIBRARY': (StrictOrderingOnAppendList, list, [], + 'SDK_LIBRARY': (StrictOrderingOnAppendList, list, """Elements of the distributed SDK. Files on this list will be copied into ``SDK_LIB_DIR`` (``$DIST/sdk/lib``). """, None), - 'SIMPLE_PROGRAMS': (StrictOrderingOnAppendList, list, [], + 'SIMPLE_PROGRAMS': (StrictOrderingOnAppendList, list, """Compile a list of executable names. Each name in this variable corresponds to an executable built from the @@ -324,7 +327,7 @@ VARIABLES = { ``BIN_SUFFIX``, the name will remain unchanged. """, 'binaries'), - 'HOST_SIMPLE_PROGRAMS': (StrictOrderingOnAppendList, list, [], + 'HOST_SIMPLE_PROGRAMS': (StrictOrderingOnAppendList, list, """Compile a list of host executable names. Each name in this variable corresponds to a hosst executable built @@ -335,7 +338,7 @@ VARIABLES = { ``HOST_BIN_SUFFIX``, the name will remain unchanged. """, 'binaries'), - 'TOOL_DIRS': (list, list, [], + 'TOOL_DIRS': (list, list, """Like DIRS but for tools. Tools are for pieces of the build system that aren't required to @@ -343,7 +346,7 @@ VARIABLES = { code and utilities. """, None), - 'TEST_DIRS': (list, list, [], + 'TEST_DIRS': (list, list, """Like DIRS but only for directories that contain test-only code. If tests are not enabled, this variable will be ignored. @@ -352,12 +355,12 @@ VARIABLES = { complete. """, None), - 'TEST_TOOL_DIRS': (list, list, [], + 'TEST_TOOL_DIRS': (list, list, """TOOL_DIRS that is only executed if tests are enabled. """, None), - 'TIERS': (OrderedDict, dict, OrderedDict(), + 'TIERS': (OrderedDict, dict, """Defines directories constituting the tier traversal mechanism. The recursive make backend iteration is organized into tiers. There are @@ -375,7 +378,7 @@ VARIABLES = { populated by calling add_tier_dir(). """, None), - 'EXTERNAL_MAKE_DIRS': (list, list, [], + 'EXTERNAL_MAKE_DIRS': (list, list, """Directories that build with make but don't use moz.build files. This is like ``DIRS`` except it implies that ``make`` is used to build the @@ -383,11 +386,11 @@ VARIABLES = { files. """, None), - 'PARALLEL_EXTERNAL_MAKE_DIRS': (list, list, [], + 'PARALLEL_EXTERNAL_MAKE_DIRS': (list, list, """Parallel version of ``EXTERNAL_MAKE_DIRS``. """, None), - 'CONFIGURE_SUBST_FILES': (StrictOrderingOnAppendList, list, [], + 'CONFIGURE_SUBST_FILES': (StrictOrderingOnAppendList, list, """Output files that will be generated using configure-like substitution. This is a substitute for ``AC_OUTPUT`` in autoconf. For each path in this @@ -397,7 +400,7 @@ VARIABLES = { ``AC_SUBST`` variables declared during configure. """, None), - 'CONFIGURE_DEFINE_FILES': (StrictOrderingOnAppendList, list, [], + 'CONFIGURE_DEFINE_FILES': (StrictOrderingOnAppendList, list, """Output files generated from configure/config.status. This is a substitute for ``AC_CONFIG_HEADER`` in autoconf. This is very @@ -405,7 +408,7 @@ VARIABLES = { into account the values of ``AC_DEFINE`` instead of ``AC_SUBST``. """, None), - 'EXPORTS': (HierarchicalStringList, list, HierarchicalStringList(), + 'EXPORTS': (HierarchicalStringList, list, """List of files to be exported, and in which subdirectories. ``EXPORTS`` is generally used to list the include files to be exported to @@ -420,7 +423,7 @@ VARIABLES = { EXPORTS.mozilla.dom += ['bar.h'] """, None), - 'PROGRAM' : (unicode, unicode, "", + 'PROGRAM' : (unicode, unicode, """Compiled executable name. If the configuration token ``BIN_SUFFIX`` is set, its value will be @@ -428,7 +431,7 @@ VARIABLES = { ``BIN_SUFFIX``, ``PROGRAM`` will remain unchanged. """, 'binaries'), - 'HOST_PROGRAM' : (unicode, unicode, "", + 'HOST_PROGRAM' : (unicode, unicode, """Compiled host executable name. If the configuration token ``HOST_BIN_SUFFIX`` is set, its value will be @@ -436,7 +439,7 @@ VARIABLES = { ends with ``HOST_BIN_SUFFIX``, ``HOST_PROGRAM`` will remain unchanged. """, 'binaries'), - 'NO_DIST_INSTALL': (bool, bool, False, + 'NO_DIST_INSTALL': (bool, bool, """Disable installing certain files into the distribution directory. If present, some files defined by other variables won't be @@ -444,7 +447,7 @@ VARIABLES = { """, None), # IDL Generation. - 'XPIDL_SOURCES': (StrictOrderingOnAppendList, list, [], + 'XPIDL_SOURCES': (StrictOrderingOnAppendList, list, """XPCOM Interface Definition Files (xpidl). This is a list of files that define XPCOM interface definitions. @@ -452,7 +455,7 @@ VARIABLES = { files. """, 'libs'), - 'XPIDL_MODULE': (unicode, unicode, "", + 'XPIDL_MODULE': (unicode, unicode, """XPCOM Interface Definition Module Name. This is the name of the ``.xpt`` file that is created by linking @@ -460,93 +463,93 @@ VARIABLES = { as ``MODULE``. """, None), - 'IPDL_SOURCES': (StrictOrderingOnAppendList, list, [], + 'IPDL_SOURCES': (StrictOrderingOnAppendList, list, """IPDL source files. These are ``.ipdl`` files that will be parsed and converted to ``.cpp`` files. """, 'export'), - 'WEBIDL_FILES': (StrictOrderingOnAppendList, list, [], + 'WEBIDL_FILES': (StrictOrderingOnAppendList, list, """WebIDL source files. These will be parsed and converted to ``.cpp`` and ``.h`` files. """, 'export'), - 'GENERATED_EVENTS_WEBIDL_FILES': (StrictOrderingOnAppendList, list, [], + 'GENERATED_EVENTS_WEBIDL_FILES': (StrictOrderingOnAppendList, list, """WebIDL source files for generated events. These will be parsed and converted to ``.cpp`` and ``.h`` files. """, 'export'), - 'TEST_WEBIDL_FILES': (StrictOrderingOnAppendList, list, [], + 'TEST_WEBIDL_FILES': (StrictOrderingOnAppendList, list, """Test WebIDL source files. These will be parsed and converted to ``.cpp`` and ``.h`` files if tests are enabled. """, 'export'), - 'GENERATED_WEBIDL_FILES': (StrictOrderingOnAppendList, list, [], + 'GENERATED_WEBIDL_FILES': (StrictOrderingOnAppendList, list, """Generated WebIDL source files. These will be generated from some other files. """, 'export'), - 'PREPROCESSED_TEST_WEBIDL_FILES': (StrictOrderingOnAppendList, list, [], + 'PREPROCESSED_TEST_WEBIDL_FILES': (StrictOrderingOnAppendList, list, """Preprocessed test WebIDL source files. These will be preprocessed, then parsed and converted to .cpp and ``.h`` files if tests are enabled. """, 'export'), - 'PREPROCESSED_WEBIDL_FILES': (StrictOrderingOnAppendList, list, [], + 'PREPROCESSED_WEBIDL_FILES': (StrictOrderingOnAppendList, list, """Preprocessed WebIDL source files. These will be preprocessed before being parsed and converted. """, 'export'), # Test declaration. - 'A11Y_MANIFESTS': (StrictOrderingOnAppendList, list, [], + 'A11Y_MANIFESTS': (StrictOrderingOnAppendList, list, """List of manifest files defining a11y tests. """, None), - 'BROWSER_CHROME_MANIFESTS': (StrictOrderingOnAppendList, list, [], + 'BROWSER_CHROME_MANIFESTS': (StrictOrderingOnAppendList, list, """List of manifest files defining browser chrome tests. """, None), - 'METRO_CHROME_MANIFESTS': (StrictOrderingOnAppendList, list, [], + 'METRO_CHROME_MANIFESTS': (StrictOrderingOnAppendList, list, """List of manifest files defining metro browser chrome tests. """, None), - 'MOCHITEST_CHROME_MANIFESTS': (StrictOrderingOnAppendList, list, [], + 'MOCHITEST_CHROME_MANIFESTS': (StrictOrderingOnAppendList, list, """List of manifest files defining mochitest chrome tests. """, None), - 'MOCHITEST_MANIFESTS': (StrictOrderingOnAppendList, list, [], + 'MOCHITEST_MANIFESTS': (StrictOrderingOnAppendList, list, """List of manifest files defining mochitest tests. """, None), - 'MOCHITEST_WEBAPPRT_CHROME_MANIFESTS': (StrictOrderingOnAppendList, list, [], + 'MOCHITEST_WEBAPPRT_CHROME_MANIFESTS': (StrictOrderingOnAppendList, list, """List of manifest files defining webapprt mochitest chrome tests. """, None), - 'WEBRTC_SIGNALLING_TEST_MANIFESTS': (StrictOrderingOnAppendList, list, [], + 'WEBRTC_SIGNALLING_TEST_MANIFESTS': (StrictOrderingOnAppendList, list, """List of manifest files defining WebRTC signalling tests. """, None), - 'XPCSHELL_TESTS_MANIFESTS': (StrictOrderingOnAppendList, list, [], + 'XPCSHELL_TESTS_MANIFESTS': (StrictOrderingOnAppendList, list, """List of manifest files defining xpcshell tests. """, None), # The following variables are used to control the target of installed files. - 'XPI_NAME': (unicode, unicode, "", + 'XPI_NAME': (unicode, unicode, """The name of an extension XPI to generate. When this variable is present, the results of this directory will end up being packaged into an extension instead of the main dist/bin results. """, 'libs'), - 'DIST_SUBDIR': (unicode, unicode, "", + 'DIST_SUBDIR': (unicode, unicode, """The name of an alternate directory to install files to. When this variable is present, the results of this directory will end up @@ -554,7 +557,7 @@ VARIABLES = { otherwise be placed. """, 'libs'), - 'FINAL_TARGET': (unicode, unicode, compute_final_target, + 'FINAL_TARGET': (FinalTargetValue, unicode, """The name of the directory to install targets to. The directory is relative to the top of the object directory. The diff --git a/python/mozbuild/mozbuild/sphinx.py b/python/mozbuild/mozbuild/sphinx.py index 38e574f9d5c..eaf3a9ea7cb 100644 --- a/python/mozbuild/mozbuild/sphinx.py +++ b/python/mozbuild/mozbuild/sphinx.py @@ -49,7 +49,7 @@ def function_reference(f, attr, args, doc): return lines -def variable_reference(v, st_type, in_type, default, doc, tier): +def variable_reference(v, st_type, in_type, doc, tier): lines = [ v, '-' * len(v), @@ -66,7 +66,6 @@ def variable_reference(v, st_type, in_type, default, doc, tier): lines.extend([ ':Storage Type: ``%s``' % st_type.__name__, ':Input Type: ``%s``' % in_type.__name__, - ':Default Value: %s' % default, '', ]) diff --git a/python/mozbuild/mozbuild/test/frontend/test_sandbox_symbols.py b/python/mozbuild/mozbuild/test/frontend/test_sandbox_symbols.py index a3de8866a60..b324f0d2560 100644 --- a/python/mozbuild/mozbuild/test/frontend/test_sandbox_symbols.py +++ b/python/mozbuild/mozbuild/test/frontend/test_sandbox_symbols.py @@ -36,7 +36,7 @@ class TestSymbols(unittest.TestCase): self.assertEqual(lines[-1].strip(), '') def test_documentation_formatting(self): - for typ, inp, default, doc, tier in VARIABLES.values(): + for typ, inp, doc, tier in VARIABLES.values(): self._verify_doc(doc) for attr, args, doc in FUNCTIONS.values(): From ae9cd73b745960c0993925781a9f13efaed8ae51 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Mon, 9 Dec 2013 13:34:00 +0900 Subject: [PATCH 36/49] Bug 946175 - Forbid assigning over a value previously set in moz.build. r=gps --- netwerk/wifi/moz.build | 7 +++---- python/mozbuild/mozbuild/frontend/reader.py | 6 +++--- python/mozbuild/mozbuild/frontend/sandbox.py | 20 +++++++++++++++++++ .../data/inheriting-variables/bar/moz.build | 2 -- .../mozbuild/test/frontend/test_namespaces.py | 15 +++++++++++++- .../mozbuild/test/frontend/test_reader.py | 2 +- .../mozbuild/test/frontend/test_sandbox.py | 4 ++-- toolkit/components/diskspacewatcher/moz.build | 1 - 8 files changed, 43 insertions(+), 14 deletions(-) diff --git a/netwerk/wifi/moz.build b/netwerk/wifi/moz.build index 1c6049d9c64..26498f931ca 100644 --- a/netwerk/wifi/moz.build +++ b/netwerk/wifi/moz.build @@ -4,8 +4,6 @@ # 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/. -FAIL_ON_WARNINGS = True - XPIDL_SOURCES += [ 'nsIWifiAccessPoint.idl', 'nsIWifiListener.idl', @@ -27,9 +25,10 @@ else: 'nsWifiMonitor.cpp', ] +# osx_corewlan.mm has warnings I don't understand. +FAIL_ON_WARNINGS = CONFIG['OS_ARCH'] != 'Darwin' + if CONFIG['OS_ARCH'] == 'Darwin': - # osx_corewlan.mm has warnings I don't understand. - FAIL_ON_WARNINGS = False UNIFIED_SOURCES += [ 'nsWifiScannerMac.cpp', ] diff --git a/python/mozbuild/mozbuild/frontend/reader.py b/python/mozbuild/mozbuild/frontend/reader.py index 979eaa2cec6..3423c32455e 100644 --- a/python/mozbuild/mozbuild/frontend/reader.py +++ b/python/mozbuild/mozbuild/frontend/reader.py @@ -185,9 +185,9 @@ class MozbuildSandbox(Sandbox): for name, func in FUNCTIONS.items(): d[name] = getattr(self, func[0]) - # Initialize the exports that we need in the global. - extra_vars = self.metadata.get('exports', dict()) - self._globals.update(extra_vars) + # Initialize the exports that we need in the global. + extra_vars = self.metadata.get('exports', dict()) + self._globals.update(extra_vars) def exec_file(self, path, filesystem_absolute=False): """Override exec_file to normalize paths and restrict file loading. diff --git a/python/mozbuild/mozbuild/frontend/sandbox.py b/python/mozbuild/mozbuild/frontend/sandbox.py index ffdb7fd904a..14d4748e88f 100644 --- a/python/mozbuild/mozbuild/frontend/sandbox.py +++ b/python/mozbuild/mozbuild/frontend/sandbox.py @@ -124,6 +124,8 @@ class GlobalNamespace(dict): self._allow_all_writes = False + self._allow_one_mutation = set() + def __getitem__(self, name): try: return dict.__getitem__(self, name) @@ -151,8 +153,21 @@ class GlobalNamespace(dict): def __setitem__(self, name, value): if self._allow_all_writes: dict.__setitem__(self, name, value) + self._allow_one_mutation.add(name) return + # Forbid assigning over a previously set value. Interestingly, when + # doing FOO += ['bar'], python actually does something like: + # foo = namespace.__getitem__('FOO') + # foo.__iadd__(['bar']) + # namespace.__setitem__('FOO', foo) + # This means __setitem__ is called with the value that is already + # in the dict, when doing +=, which is permitted. + if name in self._allow_one_mutation: + self._allow_one_mutation.remove(name) + elif name in self and dict.__getitem__(self, name) is not value: + raise Exception('Reassigning %s is forbidden' % name) + # We don't need to check for name.isupper() here because LocalNamespace # only sends variables our way if isupper() is True. stored_type, input_type, docs, tier = \ @@ -195,6 +210,11 @@ class GlobalNamespace(dict): yield self self._allow_all_writes = False + # dict.update doesn't call our __setitem__, so we have to override it. + def update(self, other): + for name, value in other.items(): + self.__setitem__(name, value) + class LocalNamespace(dict): """Represents the locals namespace in a Sandbox. diff --git a/python/mozbuild/mozbuild/test/frontend/data/inheriting-variables/bar/moz.build b/python/mozbuild/mozbuild/test/frontend/data/inheriting-variables/bar/moz.build index e0755bf8f3d..c271ec3908c 100644 --- a/python/mozbuild/mozbuild/test/frontend/data/inheriting-variables/bar/moz.build +++ b/python/mozbuild/mozbuild/test/frontend/data/inheriting-variables/bar/moz.build @@ -3,5 +3,3 @@ # 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/. - -XPIDL_MODULE = 'bazbar' diff --git a/python/mozbuild/mozbuild/test/frontend/test_namespaces.py b/python/mozbuild/mozbuild/test/frontend/test_namespaces.py index a04fb71a45f..b076c2060f0 100644 --- a/python/mozbuild/mozbuild/test/frontend/test_namespaces.py +++ b/python/mozbuild/mozbuild/test/frontend/test_namespaces.py @@ -76,10 +76,23 @@ class TestGlobalNamespace(unittest.TestCase): self.assertTrue(d['foo']) with self.assertRaises(KeyError) as ke: - ns['foo'] = False + ns['bar'] = False self.assertEqual(ke.exception.args[1], 'set_unknown') + ns['DIRS'] = [] + with self.assertRaisesRegexp(Exception, 'Reassigning .* is forbidden') as ke: + ns['DIRS'] = [] + + with ns.allow_all_writes() as d: + d['DIST_SUBDIR'] = 'foo' + + self.assertEqual(ns['DIST_SUBDIR'], 'foo') + ns['DIST_SUBDIR'] = 'bar' + self.assertEqual(ns['DIST_SUBDIR'], 'bar') + with self.assertRaisesRegexp(Exception, 'Reassigning .* is forbidden') as ke: + ns['DIST_SUBDIR'] = 'baz' + self.assertTrue(d['foo']) def test_key_checking(self): diff --git a/python/mozbuild/mozbuild/test/frontend/test_reader.py b/python/mozbuild/mozbuild/test/frontend/test_reader.py index 9d2ffe66b81..0cdcedb959f 100644 --- a/python/mozbuild/mozbuild/test/frontend/test_reader.py +++ b/python/mozbuild/mozbuild/test/frontend/test_reader.py @@ -262,7 +262,7 @@ class TestBuildReader(unittest.TestCase): self.assertEqual([sandbox['RELATIVEDIR'] for sandbox in sandboxes], ['', 'foo', 'foo/baz', 'bar']) self.assertEqual([sandbox['XPIDL_MODULE'] for sandbox in sandboxes], - ['foobar', 'foobar', 'foobar', 'bazbar']) + ['foobar', 'foobar', 'foobar', 'foobar']) if __name__ == '__main__': main() diff --git a/python/mozbuild/mozbuild/test/frontend/test_sandbox.py b/python/mozbuild/mozbuild/test/frontend/test_sandbox.py index a1e0cd2335a..fb83c9156ae 100644 --- a/python/mozbuild/mozbuild/test/frontend/test_sandbox.py +++ b/python/mozbuild/mozbuild/test/frontend/test_sandbox.py @@ -146,9 +146,9 @@ class TestSandbox(unittest.TestCase): sandbox = self.sandbox() sandbox.exec_source('DIRS = ["foo"]', 'foo.py') - sandbox.exec_source('DIRS = ["bar"]', 'foo.py') + sandbox.exec_source('DIRS += ["bar"]', 'foo.py') - self.assertEqual(sandbox['DIRS'], ['bar']) + self.assertEqual(sandbox['DIRS'], ['foo', 'bar']) def test_exec_source_illegal_key_set(self): sandbox = self.sandbox() diff --git a/toolkit/components/diskspacewatcher/moz.build b/toolkit/components/diskspacewatcher/moz.build index cda367e5b85..d5b03fba164 100644 --- a/toolkit/components/diskspacewatcher/moz.build +++ b/toolkit/components/diskspacewatcher/moz.build @@ -13,7 +13,6 @@ EXPORTS += [ ] XPIDL_MODULE = 'diskspacewatcher' -XPIDL_MODULE = 'toolkitcomps' SOURCES = [ 'DiskSpaceWatcher.cpp', From 184370343411f756cea22c4af59e82380a8e538f Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Mon, 9 Dec 2013 13:39:16 +0900 Subject: [PATCH 37/49] Bug 945042 - Add moz.build infrastructure to replace NO_PROFILE_GUIDED_OPTIMIZE from Makefile.in. r=gps --- python/mozbuild/mozbuild/frontend/emitter.py | 10 +++ .../mozbuild/frontend/sandbox_symbols.py | 9 ++- python/mozbuild/mozbuild/test/test_util.py | 35 ++++++++++ python/mozbuild/mozbuild/util.py | 68 +++++++++++++++++++ 4 files changed, 120 insertions(+), 2 deletions(-) diff --git a/python/mozbuild/mozbuild/frontend/emitter.py b/python/mozbuild/mozbuild/frontend/emitter.py index 6387a52b3c6..b55d3774486 100644 --- a/python/mozbuild/mozbuild/frontend/emitter.py +++ b/python/mozbuild/mozbuild/frontend/emitter.py @@ -258,6 +258,16 @@ class TreeMetadataEmitter(LoggingMixin): l = passthru.variables.setdefault('GARBAGE', []) l.append(f) + no_pgo = sandbox.get('NO_PGO') + sources = sandbox.get('SOURCES', []) + no_pgo_sources = [f for f in sources if sources[f].no_pgo] + if no_pgo: + if no_pgo_sources: + raise SandboxValidationError('NO_PGO and SOURCES[...].no_pgo cannot be set at the same time') + passthru.variables['NO_PROFILE_GUIDED_OPTIMIZE'] = no_pgo + if no_pgo_sources: + passthru.variables['NO_PROFILE_GUIDED_OPTIMIZE'] = no_pgo_sources + exports = sandbox.get('EXPORTS') if exports: yield Exports(sandbox, exports, diff --git a/python/mozbuild/mozbuild/frontend/sandbox_symbols.py b/python/mozbuild/mozbuild/frontend/sandbox_symbols.py index cba94004a64..ca9eaab1351 100644 --- a/python/mozbuild/mozbuild/frontend/sandbox_symbols.py +++ b/python/mozbuild/mozbuild/frontend/sandbox_symbols.py @@ -21,6 +21,7 @@ from collections import OrderedDict from mozbuild.util import ( HierarchicalStringList, StrictOrderingOnAppendList, + StrictOrderingOnAppendListWithFlagsFactory, ) from .sandbox import SandboxDerivedValue from types import StringTypes @@ -74,7 +75,7 @@ VARIABLES = { directory and merge into an APK file. """, 'export'), - 'SOURCES': (StrictOrderingOnAppendList, list, + 'SOURCES': (StrictOrderingOnAppendListWithFlagsFactory({'no_pgo': bool}), list, """Source code files. This variable contains a list of source code files to compile. @@ -296,7 +297,11 @@ VARIABLES = { """, None), 'MSVC_ENABLE_PGO': (bool, bool, - """Whether profile-guided optimization is enabled in this directory. + """Whether profile-guided optimization is enabled for MSVC in this directory. + """, None), + + 'NO_PGO': (bool, bool, + """Whether profile-guided optimization is disable in this directory. """, None), 'NO_VISIBILITY_FLAGS': (bool, bool, diff --git a/python/mozbuild/mozbuild/test/test_util.py b/python/mozbuild/mozbuild/test/test_util.py index 9801cae410d..9e1fd7cc803 100644 --- a/python/mozbuild/mozbuild/test/test_util.py +++ b/python/mozbuild/mozbuild/test/test_util.py @@ -22,6 +22,7 @@ from mozbuild.util import ( MozbuildDeletionError, HierarchicalStringList, StrictOrderingOnAppendList, + StrictOrderingOnAppendListWithFlagsFactory, UnsortedError, ) @@ -285,5 +286,39 @@ class TestStrictOrderingOnAppendList(unittest.TestCase): self.assertEqual(len(l), 2) +class TestStrictOrderingOnAppendListWithFlagsFactory(unittest.TestCase): + def test_strict_ordering_on_append_list_with_flags_factory(self): + cls = StrictOrderingOnAppendListWithFlagsFactory({ + 'foo': bool, + 'bar': int, + }) + + l = cls() + l += ['a', 'b'] + + with self.assertRaises(Exception): + l['a'] = 'foo' + + with self.assertRaises(Exception): + c = l['c'] + + self.assertEqual(l['a'].foo, False) + l['a'].foo = True + self.assertEqual(l['a'].foo, True) + + with self.assertRaises(TypeError): + l['a'].bar = 'bar' + + self.assertEqual(l['a'].bar, 0) + l['a'].bar = 42 + self.assertEqual(l['a'].bar, 42) + + l['b'].foo = True + self.assertEqual(l['b'].foo, True) + + with self.assertRaises(AttributeError): + l['b'].baz = False + + if __name__ == '__main__': main() diff --git a/python/mozbuild/mozbuild/util.py b/python/mozbuild/mozbuild/util.py index b4a487ff010..cfde6cdac12 100644 --- a/python/mozbuild/mozbuild/util.py +++ b/python/mozbuild/mozbuild/util.py @@ -301,6 +301,74 @@ class StrictOrderingOnAppendList(list): class MozbuildDeletionError(Exception): pass + +def StrictOrderingOnAppendListWithFlagsFactory(flags): + """Returns a StrictOrderingOnAppendList-like object, with optional + flags on each item. + + The flags are defined in the dict given as argument, where keys are + the flag names, and values the type used for the value of that flag. + + Example: + FooList = StrictOrderingOnAppendListWithFlagsFactory({ + 'foo': bool, 'bar': unicode + }) + foo = FooList(['a', 'b', 'c']) + foo['a'].foo = True + foo['b'].bar = 'bar' + """ + + assert isinstance(flags, dict) + assert all(isinstance(v, type) for v in flags.values()) + + class Flags(object): + __slots__ = flags.keys() + _flags = flags + + def __getattr__(self, name): + if name not in self.__slots__: + raise AttributeError("'%s' object has no attribute '%s'" % + (self.__class__.__name__, name)) + try: + return object.__getattr__(self, name) + except AttributeError: + value = self._flags[name]() + self.__setattr__(name, value) + return value + + def __setattr__(self, name, value): + if name not in self.__slots__: + raise AttributeError("'%s' object has no attribute '%s'" % + (self.__class__.__name__, name)) + if not isinstance(value, self._flags[name]): + raise TypeError("'%s' attribute of class '%s' must be '%s'" % + (name, self.__class__.__name__, + self._flags[name].__name__)) + return object.__setattr__(self, name, value) + + def __delattr__(self, name): + raise MozbuildDeletionError('Unable to delete attributes for this object') + + class StrictOrderingOnAppendListWithFlags(StrictOrderingOnAppendList): + def __init__(self, iterable=[]): + StrictOrderingOnAppendList.__init__(self, iterable) + self._flags_type = Flags + self._flags = dict() + + def __getitem__(self, name): + if name not in self._flags: + if name not in self: + raise KeyError("'%s'" % name) + self._flags[name] = self._flags_type() + return self._flags[name] + + def __setitem__(self, name, value): + raise TypeError("'%s' object does not support item assignment" % + self.__class__.__name__) + + return StrictOrderingOnAppendListWithFlags + + class HierarchicalStringList(object): """A hierarchy of lists of strings. From eaa22cd1f10e7611375bbd9a7eb624cac94c19fd Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Mon, 9 Dec 2013 13:39:26 +0900 Subject: [PATCH 38/49] Bug 945042 - Move NO_PROFILE_GUIDED_OPTIMIZE to moz.build. r=gps,r=njn --- .../shell/commandexecutehandler/Makefile.in | 2 -- .../metro/shell/commandexecutehandler/moz.build | 2 ++ browser/metro/shell/linktool/Makefile.in | 2 -- browser/metro/shell/linktool/moz.build | 2 ++ browser/metro/shell/testing/Makefile.in | 2 -- browser/metro/shell/testing/moz.build | 2 ++ build/unix/elfhack/Makefile.in | 2 -- build/unix/elfhack/inject/Makefile.in | 1 - build/unix/elfhack/inject/moz.build | 2 ++ build/unix/elfhack/moz.build | 2 ++ build/unix/stdc++compat/Makefile.in | 1 - build/unix/stdc++compat/moz.build | 2 ++ build/win32/Makefile.in | 2 -- build/win32/moz.build | 2 ++ db/sqlite3/src/Makefile.in | 5 ----- db/sqlite3/src/moz.build | 4 ++++ gfx/layers/Makefile.in | 10 ---------- gfx/layers/moz.build | 12 ++++++++++-- js/src/Makefile.in | 16 ---------------- js/src/jit/RangeAnalysis.h | 4 ++++ js/src/moz.build | 10 +++++++++- js/src/shell/Makefile.in | 7 ------- js/src/shell/moz.build | 6 ++++++ media/libvpx/Makefile.in | 9 --------- media/libvpx/moz.build | 4 ++++ memory/mozjemalloc/Makefile.in | 6 ------ memory/mozjemalloc/moz.build | 5 +++++ netwerk/sctp/datachannel/Makefile.in | 6 ------ netwerk/sctp/datachannel/moz.build | 2 ++ netwerk/sctp/src/Makefile.in | 2 -- netwerk/sctp/src/moz.build | 2 ++ xpcom/base/Makefile.in | 2 -- xpcom/base/moz.build | 4 ++-- xpcom/reflect/xptcall/src/md/unix/Makefile.in | 13 ------------- xpcom/reflect/xptcall/src/md/unix/moz.build | 2 ++ xpcom/reflect/xptcall/src/md/win32/Makefile.in | 8 -------- xpcom/reflect/xptcall/src/md/win32/moz.build | 5 +++++ 37 files changed, 69 insertions(+), 101 deletions(-) delete mode 100644 netwerk/sctp/datachannel/Makefile.in diff --git a/browser/metro/shell/commandexecutehandler/Makefile.in b/browser/metro/shell/commandexecutehandler/Makefile.in index 2f8e55fbe4a..4436b3fdc76 100644 --- a/browser/metro/shell/commandexecutehandler/Makefile.in +++ b/browser/metro/shell/commandexecutehandler/Makefile.in @@ -2,8 +2,6 @@ # 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/. -NO_PROFILE_GUIDED_OPTIMIZE = 1 - include $(topsrcdir)/config/config.mk DIST_PROGRAM = CommandExecuteHandler$(BIN_SUFFIX) diff --git a/browser/metro/shell/commandexecutehandler/moz.build b/browser/metro/shell/commandexecutehandler/moz.build index 89a07cf1bcb..cd2ac7912ba 100644 --- a/browser/metro/shell/commandexecutehandler/moz.build +++ b/browser/metro/shell/commandexecutehandler/moz.build @@ -16,3 +16,5 @@ DIST_SUBDIR = '' for var in ('UNICODE', '_UNICODE', 'NS_NO_XPCOM'): DEFINES[var] = True + +NO_PGO = True diff --git a/browser/metro/shell/linktool/Makefile.in b/browser/metro/shell/linktool/Makefile.in index 786ce3c83c7..7795c9f4c3a 100644 --- a/browser/metro/shell/linktool/Makefile.in +++ b/browser/metro/shell/linktool/Makefile.in @@ -2,8 +2,6 @@ # 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/. -NO_PROFILE_GUIDED_OPTIMIZE = 1 - include $(topsrcdir)/config/config.mk OS_LIBS = \ diff --git a/browser/metro/shell/linktool/moz.build b/browser/metro/shell/linktool/moz.build index 7d93db9dc85..5f8d38ec6bc 100644 --- a/browser/metro/shell/linktool/moz.build +++ b/browser/metro/shell/linktool/moz.build @@ -14,3 +14,5 @@ DIST_SUBDIR = 'metro/install' for var in ('UNICODE', '_UNICODE'): DEFINES[var] = True + +NO_PGO = True diff --git a/browser/metro/shell/testing/Makefile.in b/browser/metro/shell/testing/Makefile.in index 230a7912fa8..935e997cff7 100644 --- a/browser/metro/shell/testing/Makefile.in +++ b/browser/metro/shell/testing/Makefile.in @@ -9,8 +9,6 @@ USE_STATIC_LIBS = 1 MOZ_GLUE_LDFLAGS = MOZ_GLUE_PROGRAM_LDFLAGS = -NO_PROFILE_GUIDED_OPTIMIZE = 1 - include $(topsrcdir)/config/config.mk OS_LIBS = \ diff --git a/browser/metro/shell/testing/moz.build b/browser/metro/shell/testing/moz.build index fb7c08870f1..ffd44a76d4b 100644 --- a/browser/metro/shell/testing/moz.build +++ b/browser/metro/shell/testing/moz.build @@ -15,3 +15,5 @@ DIST_SUBDIR = '' for var in ('UNICODE', '_UNICODE'): DEFINES[var] = True + +NO_PGO = True diff --git a/build/unix/elfhack/Makefile.in b/build/unix/elfhack/Makefile.in index 71db949b934..cfbbb607bb3 100644 --- a/build/unix/elfhack/Makefile.in +++ b/build/unix/elfhack/Makefile.in @@ -5,8 +5,6 @@ INTERNAL_TOOLS = 1 -NO_PROFILE_GUIDED_OPTIMIZE = 1 - VPATH += $(topsrcdir)/build OS_CXXFLAGS := $(filter-out -fno-exceptions,$(OS_CXXFLAGS)) -fexceptions diff --git a/build/unix/elfhack/inject/Makefile.in b/build/unix/elfhack/inject/Makefile.in index 79831fcc411..07357a2b947 100644 --- a/build/unix/elfhack/inject/Makefile.in +++ b/build/unix/elfhack/inject/Makefile.in @@ -4,7 +4,6 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. INTERNAL_TOOLS = 1 -NO_PROFILE_GUIDED_OPTIMIZE = 1 include $(topsrcdir)/config/rules.mk diff --git a/build/unix/elfhack/inject/moz.build b/build/unix/elfhack/inject/moz.build index b560c8f69b9..3b069ef337a 100644 --- a/build/unix/elfhack/inject/moz.build +++ b/build/unix/elfhack/inject/moz.build @@ -18,3 +18,5 @@ GENERATED_SOURCES += [ ] DEFINES['ELFHACK_BUILD'] = True + +NO_PGO = True diff --git a/build/unix/elfhack/moz.build b/build/unix/elfhack/moz.build index 4a96904f228..b461987a6ae 100644 --- a/build/unix/elfhack/moz.build +++ b/build/unix/elfhack/moz.build @@ -25,3 +25,5 @@ HOST_SOURCES += [ HOST_PROGRAM = 'elfhack' DEFINES['ELFHACK_BUILD'] = True + +NO_PGO = True diff --git a/build/unix/stdc++compat/Makefile.in b/build/unix/stdc++compat/Makefile.in index dabfae73fc9..b9ef76d1b6e 100644 --- a/build/unix/stdc++compat/Makefile.in +++ b/build/unix/stdc++compat/Makefile.in @@ -4,7 +4,6 @@ STL_FLAGS = NO_EXPAND_LIBS = 1 -NO_PROFILE_GUIDED_OPTIMIZE = 1 include $(topsrcdir)/config/rules.mk diff --git a/build/unix/stdc++compat/moz.build b/build/unix/stdc++compat/moz.build index 2f0deb490e8..739879e83b1 100644 --- a/build/unix/stdc++compat/moz.build +++ b/build/unix/stdc++compat/moz.build @@ -15,3 +15,5 @@ if CONFIG['MOZ_LIBSTDCXX_HOST_VERSION']: ] FORCE_STATIC_LIB = True + +NO_PGO = True diff --git a/build/win32/Makefile.in b/build/win32/Makefile.in index 00bdae24ef9..e57bf7454d2 100644 --- a/build/win32/Makefile.in +++ b/build/win32/Makefile.in @@ -2,8 +2,6 @@ # 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/. -NO_PROFILE_GUIDED_OPTIMIZE = 1 - ifdef ENABLE_TESTS USE_STATIC_LIBS = 1 diff --git a/build/win32/moz.build b/build/win32/moz.build index 633dfffec58..2c94a64b768 100644 --- a/build/win32/moz.build +++ b/build/win32/moz.build @@ -14,3 +14,5 @@ if CONFIG['ENABLE_TESTS']: SOURCES += [ 'crashinject.cpp', ] + +NO_PGO = True diff --git a/db/sqlite3/src/Makefile.in b/db/sqlite3/src/Makefile.in index 54b0ced3de6..6a71cbf17e0 100644 --- a/db/sqlite3/src/Makefile.in +++ b/db/sqlite3/src/Makefile.in @@ -46,11 +46,6 @@ ifeq ($(OS_ARCH),WINNT) MODULE_OPTIMIZE_FLAGS = -O2 endif -# disable PGO for Sun Studio -ifdef SOLARIS_SUNPRO_CC -NO_PROFILE_GUIDED_OPTIMIZE = 1 -endif - include $(topsrcdir)/config/rules.mk # next line allows use of MOZ_OBJDIR in .mozconfig with older gcc on BeOS, maybe others diff --git a/db/sqlite3/src/moz.build b/db/sqlite3/src/moz.build index 962ce496be0..76fb9360d4a 100644 --- a/db/sqlite3/src/moz.build +++ b/db/sqlite3/src/moz.build @@ -62,3 +62,7 @@ if CONFIG['OS_TARGET'] == 'Android': if CONFIG['OS_ARCH'] == 'WINNT' and CONFIG['MOZ_MEMORY']: DEFINES['HAVE_MALLOC_USABLE_SIZE'] = True DEFINES['SQLITE_WITHOUT_MSIZE'] = True + +# disable PGO for Sun Studio +if CONFIG['SOLARIS_SUNPRO_CC']: + NO_PGO = True diff --git a/gfx/layers/Makefile.in b/gfx/layers/Makefile.in index 1a420580eaf..10c965c1c58 100644 --- a/gfx/layers/Makefile.in +++ b/gfx/layers/Makefile.in @@ -25,13 +25,3 @@ CXXFLAGS += \ $(NULL) CXXFLAGS += $(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS) $(TK_CFLAGS) - -ifdef _MSC_VER -ifeq ($(CPU_ARCH),x86_64) -# Workaround compiler bug (Bug 795594) -NO_PROFILE_GUIDED_OPTIMIZE := \ - LayerTreeInvalidation.cpp \ - Layers.cpp \ - $(NULL) -endif -endif diff --git a/gfx/layers/moz.build b/gfx/layers/moz.build index 6b5d77857bf..da5acd67dba 100644 --- a/gfx/layers/moz.build +++ b/gfx/layers/moz.build @@ -254,11 +254,9 @@ UNIFIED_SOURCES += [ 'ipc/SharedPlanarYCbCrImage.cpp', 'ipc/SharedRGBImage.cpp', 'ipc/TaskThrottler.cpp', - 'Layers.cpp', 'LayerScope.cpp', 'LayersLogging.cpp', 'LayerSorter.cpp', - 'LayerTreeInvalidation.cpp', 'opengl/CompositingRenderTargetOGL.cpp', 'opengl/CompositorOGL.cpp', 'opengl/OGLShaderProgram.cpp', @@ -274,8 +272,18 @@ UNIFIED_SOURCES += [ SOURCES += [ 'basic/BasicImageLayer.cpp', 'ImageContainer.cpp', + 'Layers.cpp', + 'LayerTreeInvalidation.cpp', ] +# Workaround compiler bug (Bug 795594) +if CONFIG['_MSC_VER'] and CONFIG['CPU_ARCH'] == 'x86_64': + for src in [ + 'Layers.cpp', + 'LayerTreeInvalidation.cpp', + ]: + SOURCES[src].no_pgo = True + if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': SOURCES += [ 'basic/MacIOSurfaceTextureHostBasic.cpp', diff --git a/js/src/Makefile.in b/js/src/Makefile.in index 14a5eade8c9..1a7008f5c4c 100644 --- a/js/src/Makefile.in +++ b/js/src/Makefile.in @@ -380,22 +380,6 @@ endif ifdef _MSC_VER # XXX We should add this to CXXFLAGS, too? CFLAGS += -fp:precise - -ifeq ($(CPU_ARCH),x86) -# Workaround compiler bug on PGO (Bug 721284) -NO_PROFILE_GUIDED_OPTIMIZE := \ - MonoIC.cpp \ - Compiler.cpp \ - $(NULL) -# Ditto (Bug 772303) -NO_PROFILE_GUIDED_OPTIMIZE += RegExp.cpp -endif -# Ditto (Bug 810661) -ifeq ($(CPU_ARCH),x86_64) -NO_PROFILE_GUIDED_OPTIMIZE := \ - CTypes.cpp \ - $(NULL) -endif endif # _MSC_VER ifeq ($(OS_ARCH),FreeBSD) diff --git a/js/src/jit/RangeAnalysis.h b/js/src/jit/RangeAnalysis.h index b75daa636aa..27ff9095672 100644 --- a/js/src/jit/RangeAnalysis.h +++ b/js/src/jit/RangeAnalysis.h @@ -13,6 +13,10 @@ #include "jit/IonAnalysis.h" #include "jit/MIR.h" +// windows.h defines those, which messes with the definitions below. +#undef min +#undef max + namespace js { namespace jit { diff --git a/js/src/moz.build b/js/src/moz.build index 37fad73e344..31769c7439b 100644 --- a/js/src/moz.build +++ b/js/src/moz.build @@ -98,7 +98,6 @@ UNIFIED_SOURCES += [ 'builtin/Object.cpp', 'builtin/ParallelArray.cpp', 'builtin/Profilers.cpp', - 'builtin/RegExp.cpp', 'builtin/TestingFunctions.cpp', 'builtin/TypedObject.cpp', 'builtin/TypeRepresentation.cpp', @@ -197,6 +196,8 @@ UNIFIED_SOURCES += [ # jsarray.cpp and jsatom.cpp cannot be built in unified mode because # xpcshell is broken during packaging when compiled with gcc-4.8.2 +# builtin/RegExp.cpp cannot be built in unified mode because it is built +# without PGO # frontend/Parser.cpp cannot be built in unified mode because of explicit # template instantiations. # jsmath.cpp cannot be built in unified mode because it needs to pull rand_s @@ -204,6 +205,7 @@ UNIFIED_SOURCES += [ # jsutil.cpp cannot be built in unified mode because it is needed for # check-vanilla-allocations. SOURCES += [ + 'builtin/RegExp.cpp', 'frontend/Parser.cpp', 'jsarray.cpp', 'jsatom.cpp', @@ -423,3 +425,9 @@ if CONFIG['JS_HAS_CTYPES']: if CONFIG['MOZ_LINKER']: DEFINES['MOZ_LINKER'] = True + +if CONFIG['_MSC_VER']: + if CONFIG['CPU_ARCH'] == 'x86': + SOURCES['builtin/RegExp.cpp'].no_pgo = True # Bug 772303 + elif CONFIG['CPU_ARCH'] == 'x86_64': + SOURCES['ctypes/CTypes.cpp'].no_pgo = True # Bug 810661 diff --git a/js/src/shell/Makefile.in b/js/src/shell/Makefile.in index d906c3d0819..a9c30fa83f5 100644 --- a/js/src/shell/Makefile.in +++ b/js/src/shell/Makefile.in @@ -4,13 +4,6 @@ # 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/. -ifdef _MSC_VER -# unnecessary PGO for js shell. But gcc cannot turn off pgo because it is -# necessary to link PGO lib on gcc when a object/static lib are compiled -# for PGO. -NO_PROFILE_GUIDED_OPTIMIZE := 1 -endif - LIBS = $(NSPR_LIBS) $(EDITLINE_LIBS) $(DEPTH)/$(LIB_PREFIX)js_static.$(LIB_SUFFIX) $(MOZ_ZLIB_LIBS) ifdef MOZ_NATIVE_FFI EXTRA_LIBS += $(MOZ_FFI_LIBS) diff --git a/js/src/shell/moz.build b/js/src/shell/moz.build index 5ede1ed468a..6c200ff04f8 100644 --- a/js/src/shell/moz.build +++ b/js/src/shell/moz.build @@ -16,3 +16,9 @@ UNIFIED_SOURCES += [ # on its behalf. for var in ('EXPORT_JS_API', 'IMPL_MFBT'): DEFINES[var] = True + +if CONFIG['_MSC_VER']: + # unnecessary PGO for js shell. But gcc cannot turn off pgo because it is + # necessary to link PGO lib on gcc when a object/static lib are compiled + # for PGO. + NO_PGO = True diff --git a/media/libvpx/Makefile.in b/media/libvpx/Makefile.in index 2f50e38fb39..f767966cac7 100644 --- a/media/libvpx/Makefile.in +++ b/media/libvpx/Makefile.in @@ -120,11 +120,6 @@ quantize_ssse3.$(OBJ_SUFFIX): vp8_asm_enc_offsets.asm ifdef VPX_NEED_OBJ_INT_EXTRACT -# only for MSVC -ifdef _MSC_VER -NO_PROFILE_GUIDED_OPTIMIZE := vpx_scale_asm_offsets.c -endif - vpx_scale_asm_offsets.asm: vpx_scale_asm_offsets.$(OBJ_SUFFIX) $(HOST_PROGRAM) ./$(HOST_PROGRAM) $(VPX_OIE_FORMAT) $< \ $(if $(VPX_AS_CONVERSION),| $(VPX_AS_CONVERSION)) > $@ @@ -135,10 +130,6 @@ OBJS := $(filter-out vpx_scale_asm_offsets.$(OBJ_SUFFIX),$(OBJS)) ifdef MOZ_VP8_ENCODER -ifdef _MSC_VER -NO_PROFILE_GUIDED_OPTIMIZE += vp8_asm_enc_offsets.c -endif - vp8_asm_enc_offsets.asm: vp8_asm_enc_offsets.$(OBJ_SUFFIX) $(HOST_PROGRAM) ./$(HOST_PROGRAM) $(VPX_OIE_FORMAT) $< \ $(if $(VPX_AS_CONVERSION),| $(VPX_AS_CONVERSION)) > $@ diff --git a/media/libvpx/moz.build b/media/libvpx/moz.build index 8e89424035f..03f013589af 100644 --- a/media/libvpx/moz.build +++ b/media/libvpx/moz.build @@ -31,10 +31,14 @@ if CONFIG['VPX_X86_ASM'] and CONFIG['OS_TARGET'] == 'WINNT': SOURCES += [ 'vpx_scale/vpx_scale_asm_offsets.c', ] + if CONFIG['_MSC_VER']: + SOURCES['vpx_scale/vpx_scale_asm_offsets.c'].no_pgo = True if CONFIG['MOZ_VP8_ENCODER']: SOURCES += [ 'vp8/encoder/vp8_asm_enc_offsets.c', ] + if CONFIG['_MSC_VER']: + SOURCES['vp8/encoder/vp8_asm_enc_offsets.c'].no_pgo = True if CONFIG['VPX_X86_ASM']: SOURCES += files['X86_ASM'] diff --git a/memory/mozjemalloc/Makefile.in b/memory/mozjemalloc/Makefile.in index 6b45d8eb9ff..678509a35d0 100644 --- a/memory/mozjemalloc/Makefile.in +++ b/memory/mozjemalloc/Makefile.in @@ -9,12 +9,6 @@ ifndef GNU_CC MODULE_OPTIMIZE_FLAGS = -xO5 endif endif - -ifeq (Linux,$(OS_TARGET)) -#XXX: PGO on Linux causes problems here -# See bug 419470 -NO_PROFILE_GUIDED_OPTIMIZE = 1 -endif endif LOCAL_INCLUDES += -I$(topsrcdir)/memory/build diff --git a/memory/mozjemalloc/moz.build b/memory/mozjemalloc/moz.build index d1d186ac731..532ca7b4c58 100644 --- a/memory/mozjemalloc/moz.build +++ b/memory/mozjemalloc/moz.build @@ -26,3 +26,8 @@ if CONFIG['MOZ_REPLACE_MALLOC']: DEFINES['MOZ_REPLACE_MALLOC'] = True DEFINES['MOZ_JEMALLOC_IMPL'] = True + +#XXX: PGO on Linux causes problems here +# See bug 419470 +if CONFIG['OS_TARGET'] == 'Linux': + NO_PGO = True diff --git a/netwerk/sctp/datachannel/Makefile.in b/netwerk/sctp/datachannel/Makefile.in deleted file mode 100644 index e74ce21e3be..00000000000 --- a/netwerk/sctp/datachannel/Makefile.in +++ /dev/null @@ -1,6 +0,0 @@ -# -# 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/. - -NO_PROFILE_GUIDED_OPTIMIZE = 1 # Don't PGO diff --git a/netwerk/sctp/datachannel/moz.build b/netwerk/sctp/datachannel/moz.build index dfaaaef4464..c871e392ec8 100644 --- a/netwerk/sctp/datachannel/moz.build +++ b/netwerk/sctp/datachannel/moz.build @@ -39,3 +39,5 @@ if CONFIG['OS_TARGET'] == 'WINNT': DEFINES['__Userspace_os_Windows'] = 1 else: DEFINES['__Userspace_os_%s' % CONFIG['OS_TARGET']] = 1 + +NO_PGO = True # Don't PGO diff --git a/netwerk/sctp/src/Makefile.in b/netwerk/sctp/src/Makefile.in index e6bf1f12602..37b8bcef202 100644 --- a/netwerk/sctp/src/Makefile.in +++ b/netwerk/sctp/src/Makefile.in @@ -3,8 +3,6 @@ # 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/. -NO_PROFILE_GUIDED_OPTIMIZE = 1 # Don't PGO - ifeq ($(OS_TARGET),Darwin) DEFINES += \ -U__APPLE__ \ diff --git a/netwerk/sctp/src/moz.build b/netwerk/sctp/src/moz.build index 508c1c00ea1..1d7f90da74d 100644 --- a/netwerk/sctp/src/moz.build +++ b/netwerk/sctp/src/moz.build @@ -80,3 +80,5 @@ if CONFIG['OS_TARGET'] == 'Darwin': if CONFIG['OS_TARGET'] in ('Linux', 'Android'): # to make sure that in6_pktinfo gets defined on all distros DEFINES['_GNU_SOURCE'] = True + +NO_PGO = True # Don't PGO diff --git a/xpcom/base/Makefile.in b/xpcom/base/Makefile.in index 4b17f704e19..c06f5109cec 100644 --- a/xpcom/base/Makefile.in +++ b/xpcom/base/Makefile.in @@ -5,8 +5,6 @@ MOZILLA_INTERNAL_API =1 -NO_PROFILE_GUIDED_OPTIMIZE = nsDebugImpl.cpp - INSTALL_TARGETS += errorlist errorlist_FILES := \ ErrorListCDefines.h \ diff --git a/xpcom/base/moz.build b/xpcom/base/moz.build index d54dd77ba98..c7638274d14 100644 --- a/xpcom/base/moz.build +++ b/xpcom/base/moz.build @@ -94,7 +94,6 @@ UNIFIED_SOURCES += [ 'nsConsoleMessage.cpp', 'nsConsoleService.cpp', 'nsCycleCollector.cpp', - 'nsDebugImpl.cpp', 'nsErrorService.cpp', 'nsGZFileWriter.cpp', 'nsInterfaceRequestorAgg.cpp', @@ -124,7 +123,8 @@ UNIFIED_SOURCES += [ 'nsErrorAssertsC.c', ] - +SOURCES += ['nsDebugImpl.cpp'] +SOURCES['nsDebugImpl.cpp'].no_pgo = True MSVC_ENABLE_PGO = True diff --git a/xpcom/reflect/xptcall/src/md/unix/Makefile.in b/xpcom/reflect/xptcall/src/md/unix/Makefile.in index 07de632ab85..8811d2d8c28 100644 --- a/xpcom/reflect/xptcall/src/md/unix/Makefile.in +++ b/xpcom/reflect/xptcall/src/md/unix/Makefile.in @@ -3,21 +3,8 @@ # 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/. -NO_PROFILE_GUIDED_OPTIMIZE = 1 - MOZILLA_INTERNAL_API = 1 -# -# The default is this buildable, but non-functioning code. -# -ifeq ($(OS_ARCH),SunOS) -ifneq (86,$(findstring 86,$(OS_TEST))) -# disable PGO for this directory with Sun Studio on SPARC because -# compiling with xprofile=collect will insert code into nsXPTCStubBase::Stub##n -NO_PROFILE_GUIDED_OPTIMIZE = 1 -endif -endif - ###################################################################### # ARM ###################################################################### diff --git a/xpcom/reflect/xptcall/src/md/unix/moz.build b/xpcom/reflect/xptcall/src/md/unix/moz.build index 0e3b0413170..be6ea33102b 100644 --- a/xpcom/reflect/xptcall/src/md/unix/moz.build +++ b/xpcom/reflect/xptcall/src/md/unix/moz.build @@ -326,3 +326,5 @@ if CONFIG['OS_ARCH'] == 'Linux': ] FINAL_LIBRARY = 'xpcom_core' + +NO_PGO = True diff --git a/xpcom/reflect/xptcall/src/md/win32/Makefile.in b/xpcom/reflect/xptcall/src/md/win32/Makefile.in index 2273c048426..6180ad7af8b 100644 --- a/xpcom/reflect/xptcall/src/md/win32/Makefile.in +++ b/xpcom/reflect/xptcall/src/md/win32/Makefile.in @@ -7,14 +7,6 @@ MOZILLA_INTERNAL_API = 1 LOCAL_INCLUDES += -I$(srcdir)/../../../../xptinfo/src - -ifneq ($(TARGET_CPU),x86_64) -ifndef GNU_CXX -# FIXME: bug 413019 -NO_PROFILE_GUIDED_OPTIMIZE = 1 -endif #!GNU_CXX -endif #!x86_64 - include $(topsrcdir)/config/rules.mk LOCAL_INCLUDES += -I$(srcdir)/../.. diff --git a/xpcom/reflect/xptcall/src/md/win32/moz.build b/xpcom/reflect/xptcall/src/md/win32/moz.build index 9fd13f5708b..141d4cd01ba 100644 --- a/xpcom/reflect/xptcall/src/md/win32/moz.build +++ b/xpcom/reflect/xptcall/src/md/win32/moz.build @@ -35,3 +35,8 @@ else: ] FINAL_LIBRARY = 'xpcom_core' + +if CONFIG['TARGET_CPU'] != 'x86_64': + if not CONFIG['GNU_CXX']: + # FIXME: bug 413019 + NO_PGO = True From d1456b8d0e843dd26b45cc6da0db60ce140858bb Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Mon, 9 Dec 2013 13:00:59 +0100 Subject: [PATCH 39/49] Backed out changeset 85196889c598 (bug 945042) PGO Test Bustage --- .../shell/commandexecutehandler/Makefile.in | 2 ++ .../metro/shell/commandexecutehandler/moz.build | 2 -- browser/metro/shell/linktool/Makefile.in | 2 ++ browser/metro/shell/linktool/moz.build | 2 -- browser/metro/shell/testing/Makefile.in | 2 ++ browser/metro/shell/testing/moz.build | 2 -- build/unix/elfhack/Makefile.in | 2 ++ build/unix/elfhack/inject/Makefile.in | 1 + build/unix/elfhack/inject/moz.build | 2 -- build/unix/elfhack/moz.build | 2 -- build/unix/stdc++compat/Makefile.in | 1 + build/unix/stdc++compat/moz.build | 2 -- build/win32/Makefile.in | 2 ++ build/win32/moz.build | 2 -- db/sqlite3/src/Makefile.in | 5 +++++ db/sqlite3/src/moz.build | 4 ---- gfx/layers/Makefile.in | 10 ++++++++++ gfx/layers/moz.build | 12 ++---------- js/src/Makefile.in | 16 ++++++++++++++++ js/src/jit/RangeAnalysis.h | 4 ---- js/src/moz.build | 10 +--------- js/src/shell/Makefile.in | 7 +++++++ js/src/shell/moz.build | 6 ------ media/libvpx/Makefile.in | 9 +++++++++ media/libvpx/moz.build | 4 ---- memory/mozjemalloc/Makefile.in | 6 ++++++ memory/mozjemalloc/moz.build | 5 ----- netwerk/sctp/datachannel/Makefile.in | 6 ++++++ netwerk/sctp/datachannel/moz.build | 2 -- netwerk/sctp/src/Makefile.in | 2 ++ netwerk/sctp/src/moz.build | 2 -- xpcom/base/Makefile.in | 2 ++ xpcom/base/moz.build | 4 ++-- xpcom/reflect/xptcall/src/md/unix/Makefile.in | 13 +++++++++++++ xpcom/reflect/xptcall/src/md/unix/moz.build | 2 -- xpcom/reflect/xptcall/src/md/win32/Makefile.in | 8 ++++++++ xpcom/reflect/xptcall/src/md/win32/moz.build | 5 ----- 37 files changed, 101 insertions(+), 69 deletions(-) create mode 100644 netwerk/sctp/datachannel/Makefile.in diff --git a/browser/metro/shell/commandexecutehandler/Makefile.in b/browser/metro/shell/commandexecutehandler/Makefile.in index 4436b3fdc76..2f8e55fbe4a 100644 --- a/browser/metro/shell/commandexecutehandler/Makefile.in +++ b/browser/metro/shell/commandexecutehandler/Makefile.in @@ -2,6 +2,8 @@ # 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/. +NO_PROFILE_GUIDED_OPTIMIZE = 1 + include $(topsrcdir)/config/config.mk DIST_PROGRAM = CommandExecuteHandler$(BIN_SUFFIX) diff --git a/browser/metro/shell/commandexecutehandler/moz.build b/browser/metro/shell/commandexecutehandler/moz.build index cd2ac7912ba..89a07cf1bcb 100644 --- a/browser/metro/shell/commandexecutehandler/moz.build +++ b/browser/metro/shell/commandexecutehandler/moz.build @@ -16,5 +16,3 @@ DIST_SUBDIR = '' for var in ('UNICODE', '_UNICODE', 'NS_NO_XPCOM'): DEFINES[var] = True - -NO_PGO = True diff --git a/browser/metro/shell/linktool/Makefile.in b/browser/metro/shell/linktool/Makefile.in index 7795c9f4c3a..786ce3c83c7 100644 --- a/browser/metro/shell/linktool/Makefile.in +++ b/browser/metro/shell/linktool/Makefile.in @@ -2,6 +2,8 @@ # 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/. +NO_PROFILE_GUIDED_OPTIMIZE = 1 + include $(topsrcdir)/config/config.mk OS_LIBS = \ diff --git a/browser/metro/shell/linktool/moz.build b/browser/metro/shell/linktool/moz.build index 5f8d38ec6bc..7d93db9dc85 100644 --- a/browser/metro/shell/linktool/moz.build +++ b/browser/metro/shell/linktool/moz.build @@ -14,5 +14,3 @@ DIST_SUBDIR = 'metro/install' for var in ('UNICODE', '_UNICODE'): DEFINES[var] = True - -NO_PGO = True diff --git a/browser/metro/shell/testing/Makefile.in b/browser/metro/shell/testing/Makefile.in index 935e997cff7..230a7912fa8 100644 --- a/browser/metro/shell/testing/Makefile.in +++ b/browser/metro/shell/testing/Makefile.in @@ -9,6 +9,8 @@ USE_STATIC_LIBS = 1 MOZ_GLUE_LDFLAGS = MOZ_GLUE_PROGRAM_LDFLAGS = +NO_PROFILE_GUIDED_OPTIMIZE = 1 + include $(topsrcdir)/config/config.mk OS_LIBS = \ diff --git a/browser/metro/shell/testing/moz.build b/browser/metro/shell/testing/moz.build index ffd44a76d4b..fb7c08870f1 100644 --- a/browser/metro/shell/testing/moz.build +++ b/browser/metro/shell/testing/moz.build @@ -15,5 +15,3 @@ DIST_SUBDIR = '' for var in ('UNICODE', '_UNICODE'): DEFINES[var] = True - -NO_PGO = True diff --git a/build/unix/elfhack/Makefile.in b/build/unix/elfhack/Makefile.in index cfbbb607bb3..71db949b934 100644 --- a/build/unix/elfhack/Makefile.in +++ b/build/unix/elfhack/Makefile.in @@ -5,6 +5,8 @@ INTERNAL_TOOLS = 1 +NO_PROFILE_GUIDED_OPTIMIZE = 1 + VPATH += $(topsrcdir)/build OS_CXXFLAGS := $(filter-out -fno-exceptions,$(OS_CXXFLAGS)) -fexceptions diff --git a/build/unix/elfhack/inject/Makefile.in b/build/unix/elfhack/inject/Makefile.in index 07357a2b947..79831fcc411 100644 --- a/build/unix/elfhack/inject/Makefile.in +++ b/build/unix/elfhack/inject/Makefile.in @@ -4,6 +4,7 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. INTERNAL_TOOLS = 1 +NO_PROFILE_GUIDED_OPTIMIZE = 1 include $(topsrcdir)/config/rules.mk diff --git a/build/unix/elfhack/inject/moz.build b/build/unix/elfhack/inject/moz.build index 3b069ef337a..b560c8f69b9 100644 --- a/build/unix/elfhack/inject/moz.build +++ b/build/unix/elfhack/inject/moz.build @@ -18,5 +18,3 @@ GENERATED_SOURCES += [ ] DEFINES['ELFHACK_BUILD'] = True - -NO_PGO = True diff --git a/build/unix/elfhack/moz.build b/build/unix/elfhack/moz.build index b461987a6ae..4a96904f228 100644 --- a/build/unix/elfhack/moz.build +++ b/build/unix/elfhack/moz.build @@ -25,5 +25,3 @@ HOST_SOURCES += [ HOST_PROGRAM = 'elfhack' DEFINES['ELFHACK_BUILD'] = True - -NO_PGO = True diff --git a/build/unix/stdc++compat/Makefile.in b/build/unix/stdc++compat/Makefile.in index b9ef76d1b6e..dabfae73fc9 100644 --- a/build/unix/stdc++compat/Makefile.in +++ b/build/unix/stdc++compat/Makefile.in @@ -4,6 +4,7 @@ STL_FLAGS = NO_EXPAND_LIBS = 1 +NO_PROFILE_GUIDED_OPTIMIZE = 1 include $(topsrcdir)/config/rules.mk diff --git a/build/unix/stdc++compat/moz.build b/build/unix/stdc++compat/moz.build index 739879e83b1..2f0deb490e8 100644 --- a/build/unix/stdc++compat/moz.build +++ b/build/unix/stdc++compat/moz.build @@ -15,5 +15,3 @@ if CONFIG['MOZ_LIBSTDCXX_HOST_VERSION']: ] FORCE_STATIC_LIB = True - -NO_PGO = True diff --git a/build/win32/Makefile.in b/build/win32/Makefile.in index e57bf7454d2..00bdae24ef9 100644 --- a/build/win32/Makefile.in +++ b/build/win32/Makefile.in @@ -2,6 +2,8 @@ # 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/. +NO_PROFILE_GUIDED_OPTIMIZE = 1 + ifdef ENABLE_TESTS USE_STATIC_LIBS = 1 diff --git a/build/win32/moz.build b/build/win32/moz.build index 2c94a64b768..633dfffec58 100644 --- a/build/win32/moz.build +++ b/build/win32/moz.build @@ -14,5 +14,3 @@ if CONFIG['ENABLE_TESTS']: SOURCES += [ 'crashinject.cpp', ] - -NO_PGO = True diff --git a/db/sqlite3/src/Makefile.in b/db/sqlite3/src/Makefile.in index 6a71cbf17e0..54b0ced3de6 100644 --- a/db/sqlite3/src/Makefile.in +++ b/db/sqlite3/src/Makefile.in @@ -46,6 +46,11 @@ ifeq ($(OS_ARCH),WINNT) MODULE_OPTIMIZE_FLAGS = -O2 endif +# disable PGO for Sun Studio +ifdef SOLARIS_SUNPRO_CC +NO_PROFILE_GUIDED_OPTIMIZE = 1 +endif + include $(topsrcdir)/config/rules.mk # next line allows use of MOZ_OBJDIR in .mozconfig with older gcc on BeOS, maybe others diff --git a/db/sqlite3/src/moz.build b/db/sqlite3/src/moz.build index 76fb9360d4a..962ce496be0 100644 --- a/db/sqlite3/src/moz.build +++ b/db/sqlite3/src/moz.build @@ -62,7 +62,3 @@ if CONFIG['OS_TARGET'] == 'Android': if CONFIG['OS_ARCH'] == 'WINNT' and CONFIG['MOZ_MEMORY']: DEFINES['HAVE_MALLOC_USABLE_SIZE'] = True DEFINES['SQLITE_WITHOUT_MSIZE'] = True - -# disable PGO for Sun Studio -if CONFIG['SOLARIS_SUNPRO_CC']: - NO_PGO = True diff --git a/gfx/layers/Makefile.in b/gfx/layers/Makefile.in index 10c965c1c58..1a420580eaf 100644 --- a/gfx/layers/Makefile.in +++ b/gfx/layers/Makefile.in @@ -25,3 +25,13 @@ CXXFLAGS += \ $(NULL) CXXFLAGS += $(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS) $(TK_CFLAGS) + +ifdef _MSC_VER +ifeq ($(CPU_ARCH),x86_64) +# Workaround compiler bug (Bug 795594) +NO_PROFILE_GUIDED_OPTIMIZE := \ + LayerTreeInvalidation.cpp \ + Layers.cpp \ + $(NULL) +endif +endif diff --git a/gfx/layers/moz.build b/gfx/layers/moz.build index da5acd67dba..6b5d77857bf 100644 --- a/gfx/layers/moz.build +++ b/gfx/layers/moz.build @@ -254,9 +254,11 @@ UNIFIED_SOURCES += [ 'ipc/SharedPlanarYCbCrImage.cpp', 'ipc/SharedRGBImage.cpp', 'ipc/TaskThrottler.cpp', + 'Layers.cpp', 'LayerScope.cpp', 'LayersLogging.cpp', 'LayerSorter.cpp', + 'LayerTreeInvalidation.cpp', 'opengl/CompositingRenderTargetOGL.cpp', 'opengl/CompositorOGL.cpp', 'opengl/OGLShaderProgram.cpp', @@ -272,18 +274,8 @@ UNIFIED_SOURCES += [ SOURCES += [ 'basic/BasicImageLayer.cpp', 'ImageContainer.cpp', - 'Layers.cpp', - 'LayerTreeInvalidation.cpp', ] -# Workaround compiler bug (Bug 795594) -if CONFIG['_MSC_VER'] and CONFIG['CPU_ARCH'] == 'x86_64': - for src in [ - 'Layers.cpp', - 'LayerTreeInvalidation.cpp', - ]: - SOURCES[src].no_pgo = True - if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': SOURCES += [ 'basic/MacIOSurfaceTextureHostBasic.cpp', diff --git a/js/src/Makefile.in b/js/src/Makefile.in index 1a7008f5c4c..14a5eade8c9 100644 --- a/js/src/Makefile.in +++ b/js/src/Makefile.in @@ -380,6 +380,22 @@ endif ifdef _MSC_VER # XXX We should add this to CXXFLAGS, too? CFLAGS += -fp:precise + +ifeq ($(CPU_ARCH),x86) +# Workaround compiler bug on PGO (Bug 721284) +NO_PROFILE_GUIDED_OPTIMIZE := \ + MonoIC.cpp \ + Compiler.cpp \ + $(NULL) +# Ditto (Bug 772303) +NO_PROFILE_GUIDED_OPTIMIZE += RegExp.cpp +endif +# Ditto (Bug 810661) +ifeq ($(CPU_ARCH),x86_64) +NO_PROFILE_GUIDED_OPTIMIZE := \ + CTypes.cpp \ + $(NULL) +endif endif # _MSC_VER ifeq ($(OS_ARCH),FreeBSD) diff --git a/js/src/jit/RangeAnalysis.h b/js/src/jit/RangeAnalysis.h index 27ff9095672..b75daa636aa 100644 --- a/js/src/jit/RangeAnalysis.h +++ b/js/src/jit/RangeAnalysis.h @@ -13,10 +13,6 @@ #include "jit/IonAnalysis.h" #include "jit/MIR.h" -// windows.h defines those, which messes with the definitions below. -#undef min -#undef max - namespace js { namespace jit { diff --git a/js/src/moz.build b/js/src/moz.build index 31769c7439b..37fad73e344 100644 --- a/js/src/moz.build +++ b/js/src/moz.build @@ -98,6 +98,7 @@ UNIFIED_SOURCES += [ 'builtin/Object.cpp', 'builtin/ParallelArray.cpp', 'builtin/Profilers.cpp', + 'builtin/RegExp.cpp', 'builtin/TestingFunctions.cpp', 'builtin/TypedObject.cpp', 'builtin/TypeRepresentation.cpp', @@ -196,8 +197,6 @@ UNIFIED_SOURCES += [ # jsarray.cpp and jsatom.cpp cannot be built in unified mode because # xpcshell is broken during packaging when compiled with gcc-4.8.2 -# builtin/RegExp.cpp cannot be built in unified mode because it is built -# without PGO # frontend/Parser.cpp cannot be built in unified mode because of explicit # template instantiations. # jsmath.cpp cannot be built in unified mode because it needs to pull rand_s @@ -205,7 +204,6 @@ UNIFIED_SOURCES += [ # jsutil.cpp cannot be built in unified mode because it is needed for # check-vanilla-allocations. SOURCES += [ - 'builtin/RegExp.cpp', 'frontend/Parser.cpp', 'jsarray.cpp', 'jsatom.cpp', @@ -425,9 +423,3 @@ if CONFIG['JS_HAS_CTYPES']: if CONFIG['MOZ_LINKER']: DEFINES['MOZ_LINKER'] = True - -if CONFIG['_MSC_VER']: - if CONFIG['CPU_ARCH'] == 'x86': - SOURCES['builtin/RegExp.cpp'].no_pgo = True # Bug 772303 - elif CONFIG['CPU_ARCH'] == 'x86_64': - SOURCES['ctypes/CTypes.cpp'].no_pgo = True # Bug 810661 diff --git a/js/src/shell/Makefile.in b/js/src/shell/Makefile.in index a9c30fa83f5..d906c3d0819 100644 --- a/js/src/shell/Makefile.in +++ b/js/src/shell/Makefile.in @@ -4,6 +4,13 @@ # 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/. +ifdef _MSC_VER +# unnecessary PGO for js shell. But gcc cannot turn off pgo because it is +# necessary to link PGO lib on gcc when a object/static lib are compiled +# for PGO. +NO_PROFILE_GUIDED_OPTIMIZE := 1 +endif + LIBS = $(NSPR_LIBS) $(EDITLINE_LIBS) $(DEPTH)/$(LIB_PREFIX)js_static.$(LIB_SUFFIX) $(MOZ_ZLIB_LIBS) ifdef MOZ_NATIVE_FFI EXTRA_LIBS += $(MOZ_FFI_LIBS) diff --git a/js/src/shell/moz.build b/js/src/shell/moz.build index 6c200ff04f8..5ede1ed468a 100644 --- a/js/src/shell/moz.build +++ b/js/src/shell/moz.build @@ -16,9 +16,3 @@ UNIFIED_SOURCES += [ # on its behalf. for var in ('EXPORT_JS_API', 'IMPL_MFBT'): DEFINES[var] = True - -if CONFIG['_MSC_VER']: - # unnecessary PGO for js shell. But gcc cannot turn off pgo because it is - # necessary to link PGO lib on gcc when a object/static lib are compiled - # for PGO. - NO_PGO = True diff --git a/media/libvpx/Makefile.in b/media/libvpx/Makefile.in index f767966cac7..2f50e38fb39 100644 --- a/media/libvpx/Makefile.in +++ b/media/libvpx/Makefile.in @@ -120,6 +120,11 @@ quantize_ssse3.$(OBJ_SUFFIX): vp8_asm_enc_offsets.asm ifdef VPX_NEED_OBJ_INT_EXTRACT +# only for MSVC +ifdef _MSC_VER +NO_PROFILE_GUIDED_OPTIMIZE := vpx_scale_asm_offsets.c +endif + vpx_scale_asm_offsets.asm: vpx_scale_asm_offsets.$(OBJ_SUFFIX) $(HOST_PROGRAM) ./$(HOST_PROGRAM) $(VPX_OIE_FORMAT) $< \ $(if $(VPX_AS_CONVERSION),| $(VPX_AS_CONVERSION)) > $@ @@ -130,6 +135,10 @@ OBJS := $(filter-out vpx_scale_asm_offsets.$(OBJ_SUFFIX),$(OBJS)) ifdef MOZ_VP8_ENCODER +ifdef _MSC_VER +NO_PROFILE_GUIDED_OPTIMIZE += vp8_asm_enc_offsets.c +endif + vp8_asm_enc_offsets.asm: vp8_asm_enc_offsets.$(OBJ_SUFFIX) $(HOST_PROGRAM) ./$(HOST_PROGRAM) $(VPX_OIE_FORMAT) $< \ $(if $(VPX_AS_CONVERSION),| $(VPX_AS_CONVERSION)) > $@ diff --git a/media/libvpx/moz.build b/media/libvpx/moz.build index 03f013589af..8e89424035f 100644 --- a/media/libvpx/moz.build +++ b/media/libvpx/moz.build @@ -31,14 +31,10 @@ if CONFIG['VPX_X86_ASM'] and CONFIG['OS_TARGET'] == 'WINNT': SOURCES += [ 'vpx_scale/vpx_scale_asm_offsets.c', ] - if CONFIG['_MSC_VER']: - SOURCES['vpx_scale/vpx_scale_asm_offsets.c'].no_pgo = True if CONFIG['MOZ_VP8_ENCODER']: SOURCES += [ 'vp8/encoder/vp8_asm_enc_offsets.c', ] - if CONFIG['_MSC_VER']: - SOURCES['vp8/encoder/vp8_asm_enc_offsets.c'].no_pgo = True if CONFIG['VPX_X86_ASM']: SOURCES += files['X86_ASM'] diff --git a/memory/mozjemalloc/Makefile.in b/memory/mozjemalloc/Makefile.in index 678509a35d0..6b45d8eb9ff 100644 --- a/memory/mozjemalloc/Makefile.in +++ b/memory/mozjemalloc/Makefile.in @@ -9,6 +9,12 @@ ifndef GNU_CC MODULE_OPTIMIZE_FLAGS = -xO5 endif endif + +ifeq (Linux,$(OS_TARGET)) +#XXX: PGO on Linux causes problems here +# See bug 419470 +NO_PROFILE_GUIDED_OPTIMIZE = 1 +endif endif LOCAL_INCLUDES += -I$(topsrcdir)/memory/build diff --git a/memory/mozjemalloc/moz.build b/memory/mozjemalloc/moz.build index 532ca7b4c58..d1d186ac731 100644 --- a/memory/mozjemalloc/moz.build +++ b/memory/mozjemalloc/moz.build @@ -26,8 +26,3 @@ if CONFIG['MOZ_REPLACE_MALLOC']: DEFINES['MOZ_REPLACE_MALLOC'] = True DEFINES['MOZ_JEMALLOC_IMPL'] = True - -#XXX: PGO on Linux causes problems here -# See bug 419470 -if CONFIG['OS_TARGET'] == 'Linux': - NO_PGO = True diff --git a/netwerk/sctp/datachannel/Makefile.in b/netwerk/sctp/datachannel/Makefile.in new file mode 100644 index 00000000000..e74ce21e3be --- /dev/null +++ b/netwerk/sctp/datachannel/Makefile.in @@ -0,0 +1,6 @@ +# +# 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/. + +NO_PROFILE_GUIDED_OPTIMIZE = 1 # Don't PGO diff --git a/netwerk/sctp/datachannel/moz.build b/netwerk/sctp/datachannel/moz.build index c871e392ec8..dfaaaef4464 100644 --- a/netwerk/sctp/datachannel/moz.build +++ b/netwerk/sctp/datachannel/moz.build @@ -39,5 +39,3 @@ if CONFIG['OS_TARGET'] == 'WINNT': DEFINES['__Userspace_os_Windows'] = 1 else: DEFINES['__Userspace_os_%s' % CONFIG['OS_TARGET']] = 1 - -NO_PGO = True # Don't PGO diff --git a/netwerk/sctp/src/Makefile.in b/netwerk/sctp/src/Makefile.in index 37b8bcef202..e6bf1f12602 100644 --- a/netwerk/sctp/src/Makefile.in +++ b/netwerk/sctp/src/Makefile.in @@ -3,6 +3,8 @@ # 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/. +NO_PROFILE_GUIDED_OPTIMIZE = 1 # Don't PGO + ifeq ($(OS_TARGET),Darwin) DEFINES += \ -U__APPLE__ \ diff --git a/netwerk/sctp/src/moz.build b/netwerk/sctp/src/moz.build index 1d7f90da74d..508c1c00ea1 100644 --- a/netwerk/sctp/src/moz.build +++ b/netwerk/sctp/src/moz.build @@ -80,5 +80,3 @@ if CONFIG['OS_TARGET'] == 'Darwin': if CONFIG['OS_TARGET'] in ('Linux', 'Android'): # to make sure that in6_pktinfo gets defined on all distros DEFINES['_GNU_SOURCE'] = True - -NO_PGO = True # Don't PGO diff --git a/xpcom/base/Makefile.in b/xpcom/base/Makefile.in index c06f5109cec..4b17f704e19 100644 --- a/xpcom/base/Makefile.in +++ b/xpcom/base/Makefile.in @@ -5,6 +5,8 @@ MOZILLA_INTERNAL_API =1 +NO_PROFILE_GUIDED_OPTIMIZE = nsDebugImpl.cpp + INSTALL_TARGETS += errorlist errorlist_FILES := \ ErrorListCDefines.h \ diff --git a/xpcom/base/moz.build b/xpcom/base/moz.build index c7638274d14..d54dd77ba98 100644 --- a/xpcom/base/moz.build +++ b/xpcom/base/moz.build @@ -94,6 +94,7 @@ UNIFIED_SOURCES += [ 'nsConsoleMessage.cpp', 'nsConsoleService.cpp', 'nsCycleCollector.cpp', + 'nsDebugImpl.cpp', 'nsErrorService.cpp', 'nsGZFileWriter.cpp', 'nsInterfaceRequestorAgg.cpp', @@ -123,8 +124,7 @@ UNIFIED_SOURCES += [ 'nsErrorAssertsC.c', ] -SOURCES += ['nsDebugImpl.cpp'] -SOURCES['nsDebugImpl.cpp'].no_pgo = True + MSVC_ENABLE_PGO = True diff --git a/xpcom/reflect/xptcall/src/md/unix/Makefile.in b/xpcom/reflect/xptcall/src/md/unix/Makefile.in index 8811d2d8c28..07de632ab85 100644 --- a/xpcom/reflect/xptcall/src/md/unix/Makefile.in +++ b/xpcom/reflect/xptcall/src/md/unix/Makefile.in @@ -3,8 +3,21 @@ # 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/. +NO_PROFILE_GUIDED_OPTIMIZE = 1 + MOZILLA_INTERNAL_API = 1 +# +# The default is this buildable, but non-functioning code. +# +ifeq ($(OS_ARCH),SunOS) +ifneq (86,$(findstring 86,$(OS_TEST))) +# disable PGO for this directory with Sun Studio on SPARC because +# compiling with xprofile=collect will insert code into nsXPTCStubBase::Stub##n +NO_PROFILE_GUIDED_OPTIMIZE = 1 +endif +endif + ###################################################################### # ARM ###################################################################### diff --git a/xpcom/reflect/xptcall/src/md/unix/moz.build b/xpcom/reflect/xptcall/src/md/unix/moz.build index be6ea33102b..0e3b0413170 100644 --- a/xpcom/reflect/xptcall/src/md/unix/moz.build +++ b/xpcom/reflect/xptcall/src/md/unix/moz.build @@ -326,5 +326,3 @@ if CONFIG['OS_ARCH'] == 'Linux': ] FINAL_LIBRARY = 'xpcom_core' - -NO_PGO = True diff --git a/xpcom/reflect/xptcall/src/md/win32/Makefile.in b/xpcom/reflect/xptcall/src/md/win32/Makefile.in index 6180ad7af8b..2273c048426 100644 --- a/xpcom/reflect/xptcall/src/md/win32/Makefile.in +++ b/xpcom/reflect/xptcall/src/md/win32/Makefile.in @@ -7,6 +7,14 @@ MOZILLA_INTERNAL_API = 1 LOCAL_INCLUDES += -I$(srcdir)/../../../../xptinfo/src + +ifneq ($(TARGET_CPU),x86_64) +ifndef GNU_CXX +# FIXME: bug 413019 +NO_PROFILE_GUIDED_OPTIMIZE = 1 +endif #!GNU_CXX +endif #!x86_64 + include $(topsrcdir)/config/rules.mk LOCAL_INCLUDES += -I$(srcdir)/../.. diff --git a/xpcom/reflect/xptcall/src/md/win32/moz.build b/xpcom/reflect/xptcall/src/md/win32/moz.build index 141d4cd01ba..9fd13f5708b 100644 --- a/xpcom/reflect/xptcall/src/md/win32/moz.build +++ b/xpcom/reflect/xptcall/src/md/win32/moz.build @@ -35,8 +35,3 @@ else: ] FINAL_LIBRARY = 'xpcom_core' - -if CONFIG['TARGET_CPU'] != 'x86_64': - if not CONFIG['GNU_CXX']: - # FIXME: bug 413019 - NO_PGO = True From 17da5c5b6950161a700bab444c57d58d7f75bf4c Mon Sep 17 00:00:00 2001 From: Patrick Wang Date: Mon, 9 Dec 2013 22:42:48 +0800 Subject: [PATCH 40/49] Bug 930282: Part 3: Don't fork after xpcom shutdown. r=khuey --- dom/ipc/PreallocatedProcessManager.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dom/ipc/PreallocatedProcessManager.cpp b/dom/ipc/PreallocatedProcessManager.cpp index 404a8d703d8..898663c004f 100644 --- a/dom/ipc/PreallocatedProcessManager.cpp +++ b/dom/ipc/PreallocatedProcessManager.cpp @@ -88,6 +88,7 @@ private: void ObserveProcessShutdown(nsISupports* aSubject); bool mEnabled; + bool mShutdown; nsRefPtr mPreallocatedAppProcess; }; @@ -114,6 +115,7 @@ PreallocatedProcessManagerImpl::PreallocatedProcessManagerImpl() , mPreallocateAppProcessTask(nullptr) , mIsNuwaReady(false) #endif + , mShutdown(false) {} void @@ -124,6 +126,8 @@ PreallocatedProcessManagerImpl::Init() if (os) { os->AddObserver(this, "ipc:content-shutdown", /* weakRef = */ false); + os->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, + /* weakRef = */ false); } RereadPrefs(); } @@ -138,6 +142,8 @@ PreallocatedProcessManagerImpl::Observe(nsISupports* aSubject, } else if (!strcmp("nsPref:changed", aTopic)) { // The only other observer we registered was for our prefs. RereadPrefs(); + } else if (!strcmp(NS_XPCOM_SHUTDOWN_OBSERVER_ID, aTopic)) { + mShutdown = true; } else { MOZ_ASSERT(false); } @@ -240,7 +246,7 @@ PreallocatedProcessManagerImpl::DelayedNuwaFork() mPreallocateAppProcessTask = nullptr; if (!mIsNuwaReady) { - if (!mPreallocatedAppProcess) { + if (!mPreallocatedAppProcess && !mShutdown) { mPreallocatedAppProcess = ContentParent::RunNuwaProcess(); } // else mPreallocatedAppProcess is starting. It will NuwaFork() when ready. From b26095729243c520a135d808177c6d6ddec19e6c Mon Sep 17 00:00:00 2001 From: Alex Keybl Date: Mon, 9 Dec 2013 13:38:06 -0500 Subject: [PATCH 41/49] Merging in version bump NO BUG --- b2g/confvars.sh | 2 +- browser/config/version.txt | 2 +- config/milestone.txt | 2 +- js/src/config/milestone.txt | 2 +- mobile/android/confvars.sh | 2 +- services/sync/Makefile.in | 2 +- xpcom/components/Module.h | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/b2g/confvars.sh b/b2g/confvars.sh index 0f9e63d0402..5e9821854e1 100644 --- a/b2g/confvars.sh +++ b/b2g/confvars.sh @@ -5,7 +5,7 @@ MOZ_APP_BASENAME=B2G MOZ_APP_VENDOR=Mozilla -MOZ_APP_VERSION=28.0a1 +MOZ_APP_VERSION=29.0a1 MOZ_APP_UA_NAME=Firefox MOZ_UA_OS_AGNOSTIC=1 diff --git a/browser/config/version.txt b/browser/config/version.txt index 70bb3e86ee9..7bb9404cdf1 100644 --- a/browser/config/version.txt +++ b/browser/config/version.txt @@ -1 +1 @@ -28.0a1 +29.0a1 diff --git a/config/milestone.txt b/config/milestone.txt index 132ff5fe00a..4f84a8e2dd0 100644 --- a/config/milestone.txt +++ b/config/milestone.txt @@ -10,4 +10,4 @@ # hardcoded milestones in the tree from these two files. #-------------------------------------------------------- -28.0a1 +29.0a1 diff --git a/js/src/config/milestone.txt b/js/src/config/milestone.txt index 132ff5fe00a..4f84a8e2dd0 100644 --- a/js/src/config/milestone.txt +++ b/js/src/config/milestone.txt @@ -10,4 +10,4 @@ # hardcoded milestones in the tree from these two files. #-------------------------------------------------------- -28.0a1 +29.0a1 diff --git a/mobile/android/confvars.sh b/mobile/android/confvars.sh index 4f79a4a03ed..829d225c9cd 100644 --- a/mobile/android/confvars.sh +++ b/mobile/android/confvars.sh @@ -5,7 +5,7 @@ MOZ_APP_BASENAME=Fennec MOZ_APP_VENDOR=Mozilla -MOZ_APP_VERSION=28.0a1 +MOZ_APP_VERSION=29.0a1 MOZ_APP_UA_NAME=Firefox MOZ_BRANDING_DIRECTORY=mobile/android/branding/unofficial diff --git a/services/sync/Makefile.in b/services/sync/Makefile.in index 26d957ee422..b24b44eebe9 100644 --- a/services/sync/Makefile.in +++ b/services/sync/Makefile.in @@ -3,7 +3,7 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. # Definitions used by constants.js. -weave_version := 1.30.0 +weave_version := 1.31.0 weave_id := {340c2bbc-ce74-4362-90b5-7c26312808ef} # Preprocess files. diff --git a/xpcom/components/Module.h b/xpcom/components/Module.h index 27449291b13..13e176d1d77 100644 --- a/xpcom/components/Module.h +++ b/xpcom/components/Module.h @@ -21,7 +21,7 @@ namespace mozilla { */ struct Module { - static const unsigned int kVersion = 28; + static const unsigned int kVersion = 29; struct CIDEntry; From ae274cdec049ee3a2ee2e9304be9b3d6cc591319 Mon Sep 17 00:00:00 2001 From: Alex Keybl Date: Mon, 9 Dec 2013 13:41:37 -0500 Subject: [PATCH 42/49] Bug 946719 - [xh, an] Add Xhosa and Aragonese locales to shipped-locales r=pike CLOSED TREE --- browser/locales/shipped-locales | 2 ++ 1 file changed, 2 insertions(+) diff --git a/browser/locales/shipped-locales b/browser/locales/shipped-locales index a66d913798f..e2042c50f69 100644 --- a/browser/locales/shipped-locales +++ b/browser/locales/shipped-locales @@ -1,5 +1,6 @@ af ak +an ar ast be @@ -79,6 +80,7 @@ th tr uk vi +xh zh-CN zh-TW zu From 23043066e7638ea99a694b7499e519e505210c00 Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Mon, 9 Dec 2013 11:50:23 -0800 Subject: [PATCH 43/49] Bumping gaia.json for 2 gaia-central revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/0f6e26b5cac9 Author: Gregor Wagner Desc: Merge pull request #14509 from etiennesegonzac/bug-946769-edge-gesture-intermittent Bug 946769 - Trying to fix the egde gesture marionette test intermittent ======== https://hg.mozilla.org/integration/gaia-central/rev/81b96ac56ca3 Author: Etienne Segonzac Desc: Bug 946769 - Trying to fix the egde gesture marionette test intermittent by properly waiting for the end of the last app-opening transition. --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 263f214b6c1..21605a60169 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "f8d3d0e31a201137e53f447d2518f93529bd7b4c", + "revision": "0f6e26b5cac949ece61366265c2f9988bae827c6", "repo_path": "/integration/gaia-central" } From 0a88c79288c931dba27affb951e3e0249e34b47c Mon Sep 17 00:00:00 2001 From: Panos Astithas Date: Mon, 9 Dec 2013 22:09:15 +0200 Subject: [PATCH 44/49] Forbid out of order resumption when two tabs with the same URL are paused (bug 947830); r=fitzgen Also consider stepping actions as a form of resumption and require the same resumption order when multiple tabs are paused. --- browser/devtools/debugger/debugger-toolbar.js | 9 ++-- toolkit/devtools/server/actors/script.js | 40 +++++++++++---- .../server/tests/unit/test_nesting-01.js | 17 +++++-- .../server/tests/unit/test_nesting-02.js | 17 +++++-- .../server/tests/unit/test_nesting-03.js | 50 +++++++++++++++++++ .../devtools/server/tests/unit/testactors.js | 4 ++ .../devtools/server/tests/unit/xpcshell.ini | 1 + 7 files changed, 119 insertions(+), 19 deletions(-) create mode 100644 toolkit/devtools/server/tests/unit/test_nesting-03.js diff --git a/browser/devtools/debugger/debugger-toolbar.js b/browser/devtools/debugger/debugger-toolbar.js index 421e4ef8c18..c10a84512a9 100644 --- a/browser/devtools/debugger/debugger-toolbar.js +++ b/browser/devtools/debugger/debugger-toolbar.js @@ -149,7 +149,8 @@ ToolbarView.prototype = { _onStepOverPressed: function() { if (DebuggerController.activeThread.paused) { DebuggerController.StackFrames.currentFrameDepth = -1; - DebuggerController.activeThread.stepOver(); + let warn = DebuggerController._ensureResumptionOrder; + DebuggerController.activeThread.stepOver(warn); } }, @@ -159,7 +160,8 @@ ToolbarView.prototype = { _onStepInPressed: function() { if (DebuggerController.activeThread.paused) { DebuggerController.StackFrames.currentFrameDepth = -1; - DebuggerController.activeThread.stepIn(); + let warn = DebuggerController._ensureResumptionOrder; + DebuggerController.activeThread.stepIn(warn); } }, @@ -169,7 +171,8 @@ ToolbarView.prototype = { _onStepOutPressed: function() { if (DebuggerController.activeThread.paused) { DebuggerController.StackFrames.currentFrameDepth = -1; - DebuggerController.activeThread.stepOut(); + let warn = DebuggerController._ensureResumptionOrder; + DebuggerController.activeThread.stepOut(warn); } }, diff --git a/toolkit/devtools/server/actors/script.js b/toolkit/devtools/server/actors/script.js index 60597e2f127..670b8d20990 100644 --- a/toolkit/devtools/server/actors/script.js +++ b/toolkit/devtools/server/actors/script.js @@ -261,19 +261,22 @@ BreakpointStore.prototype = { * @param nsIJSInspector inspector * The underlying JS inspector we use to enter and exit nested event * loops. + * @param ThreadActor thread + * The thread actor instance that owns this EventLoopStack. + * @param DebuggerServerConnection connection + * The remote protocol connection associated with this event loop stack. * @param Object hooks * An object with the following properties: * - url: The URL string of the debuggee we are spinning an event loop * for. * - preNest: function called before entering a nested event loop * - postNest: function called after exiting a nested event loop - * @param ThreadActor thread - * The thread actor instance that owns this EventLoopStack. */ -function EventLoopStack({ inspector, thread, hooks }) { +function EventLoopStack({ inspector, thread, connection, hooks }) { this._inspector = inspector; this._hooks = hooks; this._thread = thread; + this._connection = connection; } EventLoopStack.prototype = { @@ -301,6 +304,14 @@ EventLoopStack.prototype = { return url; }, + /** + * The DebuggerServerConnection of the debugger who pushed the event loop on + * top of the stack + */ + get lastConnection() { + return this._inspector.lastNestRequestor._connection; + }, + /** * Push a new nested event loop onto the stack. * @@ -310,6 +321,7 @@ EventLoopStack.prototype = { return new EventLoop({ inspector: this._inspector, thread: this._thread, + connection: this._connection, hooks: this._hooks }); } @@ -323,14 +335,17 @@ EventLoopStack.prototype = { * The JS Inspector that runs nested event loops. * @param ThreadActor thread * The thread actor that is creating this nested event loop. + * @param DebuggerServerConnection connection + * The remote protocol connection associated with this event loop. * @param Object hooks * The same hooks object passed into EventLoopStack during its * initialization. */ -function EventLoop({ inspector, thread, hooks }) { +function EventLoop({ inspector, thread, connection, hooks }) { this._inspector = inspector; this._thread = thread; this._hooks = hooks; + this._connection = connection; this.enter = this.enter.bind(this); this.resolve = this.resolve.bind(this); @@ -414,11 +429,6 @@ function ThreadActor(aHooks, aGlobal) this._frameActors = []; this._hooks = aHooks; this.global = aGlobal; - this._nestedEventLoops = new EventLoopStack({ - inspector: DebuggerServer.xpcInspector, - hooks: aHooks, - thread: this - }); // A map of actorID -> actor for breakpoints created and managed by the server. this._hiddenBreakpoints = new Map(); @@ -675,6 +685,15 @@ ThreadActor.prototype = { update(this._options, aRequest.options || {}); + // Initialize an event loop stack. This can't be done in the constructor, + // because this.conn is not yet initialized by the actor pool at that time. + this._nestedEventLoops = new EventLoopStack({ + inspector: DebuggerServer.xpcInspector, + hooks: this._hooks, + connection: this.conn, + thread: this + }); + if (!this.dbg) { this._initDebugger(); } @@ -992,7 +1011,8 @@ ThreadActor.prototype = { // different tabs or multiple debugger clients connected to the same tab) // only allow resumption in a LIFO order. if (this._nestedEventLoops.size && this._nestedEventLoops.lastPausedUrl - && this._nestedEventLoops.lastPausedUrl !== this._hooks.url) { + && (this._nestedEventLoops.lastPausedUrl !== this._hooks.url + || this._nestedEventLoops.lastConnection !== this.conn)) { return { error: "wrongOrder", message: "trying to resume in the wrong order.", diff --git a/toolkit/devtools/server/tests/unit/test_nesting-01.js b/toolkit/devtools/server/tests/unit/test_nesting-01.js index bae0edf015d..497bce84cf5 100644 --- a/toolkit/devtools/server/tests/unit/test_nesting-01.js +++ b/toolkit/devtools/server/tests/unit/test_nesting-01.js @@ -6,15 +6,26 @@ // ThreadActor.prototype.synchronize. const { defer } = devtools.require("sdk/core/promise"); +var gClient; +var gThreadActor; function run_test() { initTestDebuggerServer(); + let gDebuggee = addTestGlobal("test-nesting"); + gClient = new DebuggerClient(DebuggerServer.connectPipe()); + gClient.connect(function () { + attachTestTabAndResume(gClient, "test-nesting", function (aResponse, aTabClient, aThreadClient) { + // Reach over the protocol connection and get a reference to the thread actor. + gThreadActor = aThreadClient._transport._serverConnection.getActor(aThreadClient._actor); + + test_nesting(); + }); + }); do_test_pending(); - test_nesting(); } function test_nesting() { - const thread = new DebuggerServer.ThreadActor(DebuggerServer); + const thread = gThreadActor; const { resolve, reject, promise } = defer(); let currentStep = 0; @@ -34,5 +45,5 @@ function test_nesting() { // There shouldn't be any nested event loops anymore do_check_eq(thread._nestedEventLoops.size, 0); - do_test_finished(); + finishClient(gClient); } diff --git a/toolkit/devtools/server/tests/unit/test_nesting-02.js b/toolkit/devtools/server/tests/unit/test_nesting-02.js index ce1f9aa64da..34b6632469c 100644 --- a/toolkit/devtools/server/tests/unit/test_nesting-02.js +++ b/toolkit/devtools/server/tests/unit/test_nesting-02.js @@ -6,15 +6,26 @@ // loops when requested. const { defer } = devtools.require("sdk/core/promise"); +var gClient; +var gThreadActor; function run_test() { initTestDebuggerServer(); + let gDebuggee = addTestGlobal("test-nesting"); + gClient = new DebuggerClient(DebuggerServer.connectPipe()); + gClient.connect(function () { + attachTestTabAndResume(gClient, "test-nesting", function (aResponse, aTabClient, aThreadClient) { + // Reach over the protocol connection and get a reference to the thread actor. + gThreadActor = aThreadClient._transport._serverConnection.getActor(aThreadClient._actor); + + test_nesting(); + }); + }); do_test_pending(); - test_nesting(); } function test_nesting() { - const thread = new DebuggerServer.ThreadActor(DebuggerServer); + const thread = gThreadActor; const { resolve, reject, promise } = defer(); // The following things should happen (in order): @@ -64,5 +75,5 @@ function test_nesting() { // There shouldn't be any nested event loops anymore do_check_eq(thread._nestedEventLoops.size, 0); - do_test_finished(); + finishClient(gClient); } diff --git a/toolkit/devtools/server/tests/unit/test_nesting-03.js b/toolkit/devtools/server/tests/unit/test_nesting-03.js new file mode 100644 index 00000000000..6137a36d7c3 --- /dev/null +++ b/toolkit/devtools/server/tests/unit/test_nesting-03.js @@ -0,0 +1,50 @@ +/* -*- Mode: javascript; js-indent-level: 2; -*- */ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +// Test that we can detect nested event loops in tabs with the same URL. + +const { defer } = devtools.require("sdk/core/promise"); +var gClient1, gClient2; + +function run_test() { + initTestDebuggerServer(); + addTestGlobal("test-nesting1"); + addTestGlobal("test-nesting1"); + // Conect the first client to the first debuggee. + gClient1 = new DebuggerClient(DebuggerServer.connectPipe()); + gClient1.connect(function () { + attachTestThread(gClient1, "test-nesting1", function (aResponse, aTabClient, aThreadClient) { + start_second_connection(); + }); + }); + do_test_pending(); +} + +function start_second_connection() { + gClient2 = new DebuggerClient(DebuggerServer.connectPipe()); + gClient2.connect(function () { + attachTestThread(gClient2, "test-nesting1", function (aResponse, aTabClient, aThreadClient) { + test_nesting(); + }); + }); +} + +function test_nesting() { + const { resolve, reject, promise } = defer(); + + gClient1.activeThread.resume(aResponse => { + do_check_eq(aResponse.error, "wrongOrder"); + gClient2.activeThread.resume(aResponse => { + do_check_true(!aResponse.error); + do_check_eq(aResponse.from, gClient2.activeThread.actor); + + gClient1.activeThread.resume(aResponse => { + do_check_true(!aResponse.error); + do_check_eq(aResponse.from, gClient1.activeThread.actor); + + gClient1.close(() => finishClient(gClient2)); + }); + }); + }); +} diff --git a/toolkit/devtools/server/tests/unit/testactors.js b/toolkit/devtools/server/tests/unit/testactors.js index ce3e378b38d..14ce07eeee6 100644 --- a/toolkit/devtools/server/tests/unit/testactors.js +++ b/toolkit/devtools/server/tests/unit/testactors.js @@ -71,6 +71,10 @@ TestTabActor.prototype = { return { wrappedJSObject: this._global }; }, + get url() { + return this._global.__name; + }, + form: function() { let response = { actor: this.actorID, title: this._global.__name }; diff --git a/toolkit/devtools/server/tests/unit/xpcshell.ini b/toolkit/devtools/server/tests/unit/xpcshell.ini index ec2d0e6d058..9fa4b98d04e 100644 --- a/toolkit/devtools/server/tests/unit/xpcshell.ini +++ b/toolkit/devtools/server/tests/unit/xpcshell.ini @@ -18,6 +18,7 @@ support-files = [test_nesting-01.js] [test_nesting-02.js] +[test_nesting-03.js] [test_forwardingprefix.js] [test_getyoungestframe.js] [test_nsjsinspector.js] From fce1be3d2e0deeed962c4b609418c075219af93c Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Mon, 9 Dec 2013 12:25:30 -0800 Subject: [PATCH 45/49] Bumping gaia.json for 2 gaia-central revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/accec2f4e2c8 Author: Gregor Wagner Desc: Merge pull request #14479 from gregorwagner/disable No Bug - Disable intermittent failures ======== https://hg.mozilla.org/integration/gaia-central/rev/108ef7a4ce0d Author: Gregor Wagner Desc: Disable failing tests --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 21605a60169..9d8006eed24 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "0f6e26b5cac949ece61366265c2f9988bae827c6", + "revision": "accec2f4e2c8cc463f3f255aa6e21e5669578fc2", "repo_path": "/integration/gaia-central" } From c8ccf9a4f835527cf2eb5388fb4008e315a1ffcc Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Mon, 9 Dec 2013 15:54:27 -0500 Subject: [PATCH 46/49] Backed out changeset 772c30e9e812 (bug 944255) for mochitest-mc orange. --- browser/metro/modules/View.jsm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/browser/metro/modules/View.jsm b/browser/metro/modules/View.jsm index cd60b89181f..d2e77185658 100644 --- a/browser/metro/modules/View.jsm +++ b/browser/metro/modules/View.jsm @@ -27,18 +27,18 @@ function makeURI(aURL, aOriginCharset, aBaseURI) { function View(aSet) { this._set = aSet; this._set.controller = this; - this._window = aSet.ownerDocument.defaultView; - - this.onResize = () => this._adjustDOMforViewState(); - this._window.addEventListener("resize", this.onResize); + this.viewStateObserver = { + observe: (aSubject, aTopic, aData) => this._adjustDOMforViewState(aData) + }; + Services.obs.addObserver(this.viewStateObserver, "metro_viewstate_changed", false); ColorUtils.init(); this._adjustDOMforViewState(); } View.prototype = { destruct: function () { - this._window.removeEventListener("resize", this.onResize); + Services.obs.removeObserver(this.viewStateObserver, "metro_viewstate_changed"); }, _adjustDOMforViewState: function _adjustDOMforViewState(aState) { From c018348b9c74226a65133c07bc623e73bd3f0135 Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Mon, 9 Dec 2013 13:00:39 -0800 Subject: [PATCH 47/49] Bumping gaia.json for 1 gaia-central revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/d5f4a104c0b7 Author: John Ford Desc: Revert "Bug 944718 - [Cost Control] Broken access to usage widget from utility tray" This reverts commit 31bbe151e0d92da77a86a3ae5edb6ca2643968e1. This is the second time this patch has been backed out. https://bugzilla.mozilla.org/show_bug.cgi?id=944718 --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 9d8006eed24..08e70b618f4 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "accec2f4e2c8cc463f3f255aa6e21e5669578fc2", + "revision": "d5f4a104c0b79b8fe13b7883dd531249ed251146", "repo_path": "/integration/gaia-central" } From e13d566dfb12612c53e086cd934680d2dec77488 Mon Sep 17 00:00:00 2001 From: Reuben Morais Date: Mon, 9 Dec 2013 19:01:42 -0200 Subject: [PATCH 48/49] Bug 697343 - Create the results array in the content scope. r=bz --HG-- extra : rebase_source : ae7ae1873dc1f074942858c4d37e3d5916e42223 --- dom/contacts/ContactManager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom/contacts/ContactManager.js b/dom/contacts/ContactManager.js index 8042325cfde..81232a3a6d9 100644 --- a/dom/contacts/ContactManager.js +++ b/dom/contacts/ContactManager.js @@ -400,7 +400,7 @@ ContactManager.prototype = { }, _convertContacts: function(aContacts) { - let contacts = []; + let contacts = new this._window.Array(); for (let i in aContacts) { contacts.push(this._convertContact(aContacts[i])); } From 40fc3e702610a532cc904174338ed6b553477354 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Mon, 9 Dec 2013 17:24:14 -0500 Subject: [PATCH 49/49] Backed out changesets 572624d76edf and 17a5f2e554e8 (bug 934739) for causing bug 947879. --- .../mozbuild/backend/recursivemake.py | 8 --- python/mozbuild/mozbuild/frontend/data.py | 5 -- python/mozbuild/mozbuild/frontend/emitter.py | 21 +++++- .../data/test-manifests-written/xpcshell.ini | 1 - .../test/backend/test_recursivemake.py | 12 ---- .../mozbuild/test/frontend/test_emitter.py | 7 +- python/mozbuild/mozpack/manifests.py | 70 ++----------------- .../mozbuild/mozpack/test/test_manifests.py | 46 +++--------- 8 files changed, 39 insertions(+), 131 deletions(-) diff --git a/python/mozbuild/mozbuild/backend/recursivemake.py b/python/mozbuild/mozbuild/backend/recursivemake.py index d5b9b1501bb..b8f8b61b20d 100644 --- a/python/mozbuild/mozbuild/backend/recursivemake.py +++ b/python/mozbuild/mozbuild/backend/recursivemake.py @@ -1051,14 +1051,6 @@ class RecursiveMakeBackend(CommonBackend): if not obj.dupe_manifest: raise - for base, pattern, dest in obj.pattern_installs: - try: - self._install_manifests['tests'].add_pattern_symlink(base, - pattern, dest) - except ValueError: - if not obj.dupe_manifest: - raise - for dest in obj.external_installs: try: self._install_manifests['tests'].add_optional_exists(dest) diff --git a/python/mozbuild/mozbuild/frontend/data.py b/python/mozbuild/mozbuild/frontend/data.py index ea8d066044c..dfa16a0a0df 100644 --- a/python/mozbuild/mozbuild/frontend/data.py +++ b/python/mozbuild/mozbuild/frontend/data.py @@ -361,10 +361,6 @@ class TestManifest(SandboxDerived): # path is relative from the tests root directory. 'installs', - # A list of pattern matching installs to perform. Entries are - # (base, pattern, dest). - 'pattern_installs', - # Where all files for this manifest flavor are installed in the unified # test package directory. 'install_prefix', @@ -404,7 +400,6 @@ class TestManifest(SandboxDerived): self.manifest_relpath = relpath self.dupe_manifest = dupe_manifest self.installs = {} - self.pattern_installs = [] self.tests = [] self.external_installs = set() diff --git a/python/mozbuild/mozbuild/frontend/emitter.py b/python/mozbuild/mozbuild/frontend/emitter.py index 6d456215cf9..b55d3774486 100644 --- a/python/mozbuild/mozbuild/frontend/emitter.py +++ b/python/mozbuild/mozbuild/frontend/emitter.py @@ -15,6 +15,8 @@ from mach.mixin.logging import LoggingMixin import mozpack.path as mozpath import manifestparser +from mozpack.files import FileFinder + from .data import ( ConfigFileSubstitution, Defines, @@ -403,6 +405,8 @@ class TreeMetadataEmitter(LoggingMixin): out_dir = mozpath.join(install_prefix, manifest_reldir) + finder = FileFinder(base=manifest_dir, find_executables=False) + # "head" and "tail" lists. # All manifests support support-files. # @@ -427,9 +431,22 @@ class TreeMetadataEmitter(LoggingMixin): for pattern in value.split(): # We only support globbing on support-files because # the harness doesn't support * for head and tail. + # + # While we could feed everything through the finder, we + # don't because we want explicitly listed files that + # no longer exist to raise an error. The finder is also + # slower than simple lookup. if '*' in pattern and thing == 'support-files': - obj.pattern_installs.append( - (manifest_dir, pattern, out_dir)) + paths = [f[0] for f in finder.find(pattern)] + if not paths: + raise SandboxValidationError('%s support-files ' + 'wildcard in %s returns no results.' % ( + pattern, path)) + + for f in paths: + full = mozpath.normpath(mozpath.join(manifest_dir, f)) + obj.installs[full] = mozpath.join(out_dir, f) + else: full = mozpath.normpath(mozpath.join(manifest_dir, pattern)) diff --git a/python/mozbuild/mozbuild/test/backend/data/test-manifests-written/xpcshell.ini b/python/mozbuild/mozbuild/test/backend/data/test-manifests-written/xpcshell.ini index f6a5351e94e..8dada2a4e5f 100644 --- a/python/mozbuild/mozbuild/test/backend/data/test-manifests-written/xpcshell.ini +++ b/python/mozbuild/mozbuild/test/backend/data/test-manifests-written/xpcshell.ini @@ -1,4 +1,3 @@ [DEFAULT] -support-files = support/** [xpcshell.js] diff --git a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py index 199718ca593..4c4046de679 100644 --- a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py +++ b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py @@ -382,18 +382,6 @@ class TestRecursiveMakeBackend(BackendTester): self.assertEqual(len(o['xpcshell.js']), 1) - def test_test_manifest_pattern_matches_recorded(self): - """Pattern matches in test manifests' support-files should be recorded.""" - env = self._consume('test-manifests-written', RecursiveMakeBackend) - m = InstallManifest(path=os.path.join(env.topobjdir, - '_build_manifests', 'install', 'tests')) - - # This is not the most robust test in the world, but it gets the job - # done. - entries = [e for e in m._dests.keys() if '**' in e] - self.assertEqual(len(entries), 1) - self.assertIn('support/**', entries[0]) - def test_xpidl_generation(self): """Ensure xpidl files and directories are written out.""" env = self._consume('xpidl', RecursiveMakeBackend) diff --git a/python/mozbuild/mozbuild/test/frontend/test_emitter.py b/python/mozbuild/mozbuild/test/frontend/test_emitter.py index 772afc1a869..aafb4f6eaf4 100644 --- a/python/mozbuild/mozbuild/test/frontend/test_emitter.py +++ b/python/mozbuild/mozbuild/test/frontend/test_emitter.py @@ -248,8 +248,10 @@ class TestEmitterBasic(unittest.TestCase): 'installs': { 'a11y.ini', 'test_a11y.js', + # From ** wildcard. + 'a11y-support/foo', + 'a11y-support/dir1/bar', }, - 'pattern-installs': 1, }, 'browser.ini': { 'flavor': 'browser-chrome', @@ -317,9 +319,6 @@ class TestEmitterBasic(unittest.TestCase): self.assertIn(path, m['installs']) - if 'pattern-installs' in m: - self.assertEqual(len(o.pattern_installs), m['pattern-installs']) - def test_test_manifest_unmatched_generated(self): reader = self.reader('test-manifest-unmatched-generated') diff --git a/python/mozbuild/mozpack/manifests.py b/python/mozbuild/mozpack/manifests.py index e91e14026cc..462e0f9c82f 100644 --- a/python/mozbuild/mozpack/manifests.py +++ b/python/mozbuild/mozpack/manifests.py @@ -6,11 +6,11 @@ from __future__ import unicode_literals from contextlib import contextmanager +from .copier import FilePurger from .files import ( AbsoluteSymlinkFile, ExistingFile, File, - FileFinder, ) import mozpack.path as mozpath @@ -63,15 +63,8 @@ class InstallManifest(object): the FileCopier. No error is raised if the destination path does not exist. - patternsymlink -- Paths matched by the expression in the source path - will be symlinked to the destination directory. - - patterncopy -- Similar to patternsymlink except files are copied, not - symlinked. - - Version 1 of the manifest was the initial version. - Version 2 added optional path support - Version 3 added support for pattern entries. + Versions 1 and 2 of the manifest format are similar. Version 2 added + optional path support. """ FIELD_SEPARATOR = '\x1f' @@ -79,8 +72,6 @@ class InstallManifest(object): COPY = 2 REQUIRED_EXISTS = 3 OPTIONAL_EXISTS = 4 - PATTERN_SYMLINK = 5 - PATTERN_COPY = 6 def __init__(self, path=None, fileobj=None): """Create a new InstallManifest entry. @@ -103,7 +94,7 @@ class InstallManifest(object): def _load_from_fileobj(self, fileobj): version = fileobj.readline().rstrip() - if version not in ('1', '2', '3'): + if version not in ('1', '2'): raise UnreadableInstallManifest('Unknown manifest version: ' % version) @@ -115,7 +106,7 @@ class InstallManifest(object): record_type = int(fields[0]) if record_type == self.SYMLINK: - dest, source = fields[1:] + dest, source= fields[1:] self.add_symlink(source, dest) continue @@ -134,16 +125,6 @@ class InstallManifest(object): self.add_optional_exists(path) continue - if record_type == self.PATTERN_SYMLINK: - _, base, pattern, dest = fields[1:] - self.add_pattern_symlink(base, pattern, dest) - continue - - if record_type == self.PATTERN_COPY: - _, base, pattern, dest = fields[1:] - self.add_pattern_copy(base, pattern, dest) - continue - raise UnreadableInstallManifest('Unknown record type: %d' % record_type) @@ -177,7 +158,7 @@ class InstallManifest(object): It is an error if both are specified. """ with _auto_fileobj(path, fileobj, 'wb') as fh: - fh.write('3\n') + fh.write('2\n') for dest in sorted(self._dests): entry = self._dests[dest] @@ -217,29 +198,6 @@ class InstallManifest(object): """ self._add_entry(dest, (self.OPTIONAL_EXISTS,)) - def add_pattern_symlink(self, base, pattern, dest): - """Add a pattern match that results in symlinks being created. - - A ``FileFinder`` will be created with its base set to ``base`` - and ``FileFinder.find()`` will be called with ``pattern`` to discover - source files. Each source file will be symlinked under ``dest``. - - Filenames under ``dest`` are constructed by taking the path fragment - after ``base`` and concatenating it with ``dest``. e.g. - - /foo/bar.h -> /foo/bar.h - """ - self._add_entry(mozpath.join(base, pattern, dest), - (self.PATTERN_SYMLINK, base, pattern, dest)) - - def add_pattern_copy(self, base, pattern, dest): - """Add a pattern match that results in copies. - - See ``add_pattern_symlink()`` for usage. - """ - self._add_entry(mozpath.join(base, pattern, dest), - (self.PATTERN_COPY, base, pattern, dest)) - def _add_entry(self, dest, entry): if dest in self._dests: raise ValueError('Item already in manifest: %s' % dest) @@ -273,21 +231,5 @@ class InstallManifest(object): registry.add(dest, ExistingFile(required=False)) continue - if install_type in (self.PATTERN_SYMLINK, self.PATTERN_COPY): - _, base, pattern, dest = entry - finder = FileFinder(base, find_executables=False) - paths = [f[0] for f in finder.find(pattern)] - - if install_type == self.PATTERN_SYMLINK: - cls = AbsoluteSymlinkFile - else: - cls = File - - for path in paths: - source = mozpath.join(base, path) - registry.add(mozpath.join(dest, path), cls(source)) - - continue - raise Exception('Unknown install type defined in manifest: %d' % install_type) diff --git a/python/mozbuild/mozpack/test/test_manifests.py b/python/mozbuild/mozpack/test/test_manifests.py index 87e3add84dc..667972d3f08 100644 --- a/python/mozbuild/mozpack/test/test_manifests.py +++ b/python/mozbuild/mozpack/test/test_manifests.py @@ -29,10 +29,8 @@ class TestInstallManifest(TestWithTmpDir): m.add_copy('c_source', 'c_dest') m.add_required_exists('e_dest') m.add_optional_exists('o_dest') - m.add_pattern_symlink('ps_base', 'ps/*', 'ps_dest') - m.add_pattern_copy('pc_base', 'pc/**', 'pc_dest') - self.assertEqual(len(m), 6) + self.assertEqual(len(m), 4) self.assertIn('s_dest', m) self.assertIn('c_dest', m) self.assertIn('e_dest', m) @@ -50,20 +48,12 @@ class TestInstallManifest(TestWithTmpDir): with self.assertRaises(ValueError): m.add_optional_exists('o_dest') - with self.assertRaises(ValueError): - m.add_pattern_symlink('ps_base', 'ps/*', 'ps_dest') - - with self.assertRaises(ValueError): - m.add_pattern_copy('pc_base', 'pc/**', 'pc_dest') - def _get_test_manifest(self): m = InstallManifest() m.add_symlink(self.tmppath('s_source'), 's_dest') m.add_copy(self.tmppath('c_source'), 'c_dest') m.add_required_exists('e_dest') m.add_optional_exists('o_dest') - m.add_pattern_symlink('ps_base', '*', 'ps_dest') - m.add_pattern_copy('pc_base', '**', 'pc_dest') return m @@ -77,12 +67,18 @@ class TestInstallManifest(TestWithTmpDir): with open(p, 'rb') as fh: c = fh.read() - self.assertEqual(c.count('\n'), 7) + self.assertEqual(c.count('\n'), 5) lines = c.splitlines() - self.assertEqual(len(lines), 7) + self.assertEqual(len(lines), 5) - self.assertEqual(lines[0], '3') + self.assertEqual(lines[0], '2') + self.assertEqual(lines[1], '2\x1fc_dest\x1f%s' % + self.tmppath('c_source')) + self.assertEqual(lines[2], '3\x1fe_dest') + self.assertEqual(lines[3], '4\x1fo_dest') + self.assertEqual(lines[4], '1\x1fs_dest\x1f%s' % + self.tmppath('s_source')) m2 = InstallManifest(path=p) self.assertEqual(m, m2) @@ -102,28 +98,8 @@ class TestInstallManifest(TestWithTmpDir): self.assertEqual(len(r), 4) self.assertEqual(r.paths(), ['c_dest', 'e_dest', 'o_dest', 's_dest']) - def test_pattern_expansion(self): - source = self.tmppath('source') - os.mkdir(source) - os.mkdir('%s/base' % source) - os.mkdir('%s/base/foo' % source) - - with open('%s/base/foo/file1' % source, 'a'): - pass - - with open('%s/base/foo/file2' % source, 'a'): - pass - - m = InstallManifest() - m.add_pattern_symlink('%s/base' % source, '**', 'dest') - - c = FileCopier() - m.populate_registry(c) - self.assertEqual(c.paths(), ['dest/foo/file1', 'dest/foo/file2']) - def test_or(self): m1 = self._get_test_manifest() - orig_length = len(m1) m2 = InstallManifest() m2.add_symlink('s_source2', 's_dest2') m2.add_copy('c_source2', 'c_dest2') @@ -131,7 +107,7 @@ class TestInstallManifest(TestWithTmpDir): m1 |= m2 self.assertEqual(len(m2), 2) - self.assertEqual(len(m1), orig_length + 2) + self.assertEqual(len(m1), 6) self.assertIn('s_dest2', m1) self.assertIn('c_dest2', m1)