Merge m-c to fx-team on a CLOSED TREE.

This commit is contained in:
Ryan VanderMeulen 2014-05-20 15:01:13 -04:00
commit 0494816c78
78 changed files with 1145 additions and 1586 deletions

View File

@ -19,8 +19,8 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9ad117d9d7f4d9e76ca235b168a3ac79f870f4c1"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3b2aeeb5af3083c2f6f4b44beae0b4802566d482"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c462d9183d294a2d8ecc472f593ea8cfa15bc9de"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="996b5c6a2fd2b8a0124c0eab80eb72a4daece7bc"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="ca283b9db2b151d465cfd2e19346cf58fe89e413"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="e5f4683183a1dec2cfdb21b76509819977e9d09c"/>

View File

@ -17,8 +17,8 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9ad117d9d7f4d9e76ca235b168a3ac79f870f4c1"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3b2aeeb5af3083c2f6f4b44beae0b4802566d482"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c462d9183d294a2d8ecc472f593ea8cfa15bc9de"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="996b5c6a2fd2b8a0124c0eab80eb72a4daece7bc"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8a4baf82a131a7853cf7e7f9cf74253927b2f355"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
@ -128,7 +128,7 @@
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="3a9a17613cc685aa232432566ad6cc607eab4ec1"/>
<project name="device_generic_goldfish" path="device/generic/goldfish" remote="b2g" revision="c3ee0c875393607430086f942950d1b3f496ab0e"/>
<project name="platform/external/libnfc-nci" path="external/libnfc-nci" revision="7d33aaf740bbf6c7c6e9c34a92b371eda311b66b"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="f121175e1c0613f7d5c39be84b5a6330d8d664a0"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="acbdbe5196f06589da05c3bd1f14b27a6cae69c2"/>
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="0e56e450367cd802241b27164a2979188242b95f"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="dd94b2e17a146cb782d71933d25dcaa9c060e6ce"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="e0972cffef81e3833a5dad03a338651ebe55135f"/>

View File

@ -15,9 +15,9 @@
<project name="platform_build" path="build" remote="b2g" revision="65fba428f8d76336b33ddd9e15900357953600ba">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9ad117d9d7f4d9e76ca235b168a3ac79f870f4c1"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c462d9183d294a2d8ecc472f593ea8cfa15bc9de"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3b2aeeb5af3083c2f6f4b44beae0b4802566d482"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="996b5c6a2fd2b8a0124c0eab80eb72a4daece7bc"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>

View File

@ -19,8 +19,8 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9ad117d9d7f4d9e76ca235b168a3ac79f870f4c1"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3b2aeeb5af3083c2f6f4b44beae0b4802566d482"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c462d9183d294a2d8ecc472f593ea8cfa15bc9de"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="996b5c6a2fd2b8a0124c0eab80eb72a4daece7bc"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="ca283b9db2b151d465cfd2e19346cf58fe89e413"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="e5f4683183a1dec2cfdb21b76509819977e9d09c"/>

View File

@ -18,8 +18,8 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9ad117d9d7f4d9e76ca235b168a3ac79f870f4c1"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3b2aeeb5af3083c2f6f4b44beae0b4802566d482"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c462d9183d294a2d8ecc472f593ea8cfa15bc9de"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="996b5c6a2fd2b8a0124c0eab80eb72a4daece7bc"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8a4baf82a131a7853cf7e7f9cf74253927b2f355"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>

View File

@ -4,6 +4,6 @@
"remote": "",
"branch": ""
},
"revision": "6b51afcf6d39fc4b30dc0d9b5d9f5739b2a6fd60",
"revision": "2f15fe97023bf41e29660a2d427bd43a3ff181b0",
"repo_path": "/integration/gaia-central"
}

View File

@ -17,8 +17,8 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9ad117d9d7f4d9e76ca235b168a3ac79f870f4c1"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3b2aeeb5af3083c2f6f4b44beae0b4802566d482"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c462d9183d294a2d8ecc472f593ea8cfa15bc9de"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="996b5c6a2fd2b8a0124c0eab80eb72a4daece7bc"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>

View File

@ -15,8 +15,8 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9ad117d9d7f4d9e76ca235b168a3ac79f870f4c1"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3b2aeeb5af3083c2f6f4b44beae0b4802566d482"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c462d9183d294a2d8ecc472f593ea8cfa15bc9de"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="996b5c6a2fd2b8a0124c0eab80eb72a4daece7bc"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>

View File

@ -19,8 +19,8 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9ad117d9d7f4d9e76ca235b168a3ac79f870f4c1"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3b2aeeb5af3083c2f6f4b44beae0b4802566d482"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c462d9183d294a2d8ecc472f593ea8cfa15bc9de"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="996b5c6a2fd2b8a0124c0eab80eb72a4daece7bc"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>

View File

@ -17,8 +17,8 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9ad117d9d7f4d9e76ca235b168a3ac79f870f4c1"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3b2aeeb5af3083c2f6f4b44beae0b4802566d482"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c462d9183d294a2d8ecc472f593ea8cfa15bc9de"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="996b5c6a2fd2b8a0124c0eab80eb72a4daece7bc"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>

View File

@ -17,8 +17,8 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9ad117d9d7f4d9e76ca235b168a3ac79f870f4c1"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3b2aeeb5af3083c2f6f4b44beae0b4802566d482"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c462d9183d294a2d8ecc472f593ea8cfa15bc9de"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="996b5c6a2fd2b8a0124c0eab80eb72a4daece7bc"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8a4baf82a131a7853cf7e7f9cf74253927b2f355"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>

View File

@ -17,8 +17,8 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9ad117d9d7f4d9e76ca235b168a3ac79f870f4c1"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3b2aeeb5af3083c2f6f4b44beae0b4802566d482"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c462d9183d294a2d8ecc472f593ea8cfa15bc9de"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="996b5c6a2fd2b8a0124c0eab80eb72a4daece7bc"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>

View File

@ -3414,7 +3414,7 @@ let SessionStoreInternal = {
* with respect to |browser|.
*/
isCurrentEpoch: function (browser, epoch) {
return this._browserEpochs.get(browser.permanentKey, 0) == epoch;
return (this._browserEpochs.get(browser.permanentKey) || 0) == epoch;
},
};

View File

@ -2163,7 +2163,7 @@ ia64*-hpux*)
LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib netapi32.lib"
MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
WARNINGS_AS_ERRORS='-WX'
MOZ_OPTIMIZE_FLAGS='-O1'
MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
MOZ_FIX_LINK_PATHS=
MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"

View File

@ -639,9 +639,11 @@ ContentSecurityPolicy.prototype = {
}
var violationMessage = null;
if (blockedUri["asciiSpec"]) {
violationMessage = CSPLocalizer.getFormatStr("CSPViolationWithURI", [violatedDirective, blockedUri.asciiSpec]);
let localizeString = policy._reportOnlyMode ? "CSPROViolationWithURI" : "CSPViolationWithURI";
violationMessage = CSPLocalizer.getFormatStr(localizeString, [violatedDirective, blockedUri.asciiSpec]);
} else {
violationMessage = CSPLocalizer.getFormatStr("CSPViolation", [violatedDirective]);
let localizeString = policy._reportOnlyMode ? "CSPROViolation" : "CSPViolation";
violationMessage = CSPLocalizer.getFormatStr(localizeString, [violatedDirective]);
}
policy.log(WARN_FLAG, violationMessage,
(aSourceFile) ? aSourceFile : null,

View File

@ -12,6 +12,7 @@
#include "mozilla/EventStates.h"
#include "mozilla/dom/HTMLFormControlsCollection.h"
#include "mozilla/dom/HTMLFormElementBinding.h"
#include "mozilla/Move.h"
#include "nsIHTMLDocument.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"
@ -1511,7 +1512,7 @@ HTMLFormElement::FlushPendingSubmission()
if (mPendingSubmission) {
// Transfer owning reference so that the submissioin doesn't get deleted
// if we reenter
nsAutoPtr<nsFormSubmission> submission = mPendingSubmission;
nsAutoPtr<nsFormSubmission> submission = Move(mPendingSubmission);
SubmitSubmission(submission);
}

View File

@ -15,7 +15,6 @@ LoadManager* LoadManagerBuild(void)
{
MOZ_ASSERT(NS_IsMainThread());
#if defined(ANDROID) || defined(LINUX)
int loadMeasurementInterval =
mozilla::Preferences::GetInt("media.navigator.load_adapt.measure_interval", 1000);
int averagingSeconds =
@ -29,10 +28,6 @@ LoadManager* LoadManagerBuild(void)
averagingSeconds,
highLoadThreshold,
lowLoadThreshold);
#else
// LoadManager not implemented on this platform.
return nullptr;
#endif
}
void LoadManagerDestroy(mozilla::LoadManager* aLoadManager)

View File

@ -29,6 +29,19 @@
#include <unistd.h>
#endif
#ifdef XP_MACOSX
#include <sys/time.h>
#include <mach/mach_host.h>
#include <mach/mach_init.h>
#include <mach/host_info.h>
#endif
#ifdef XP_WIN
#include <pdh.h>
#include <tchar.h>
#pragma comment(lib, "pdh.lib")
#endif
// NSPR_LOG_MODULES=LoadManager:5
#undef LOG
#undef LOG_ENABLED
@ -141,6 +154,109 @@ void LoadMonitor::Shutdown()
}
}
#ifdef XP_WIN
static LPCTSTR TotalCounterPath = _T("\\Processor(_Total)\\% Processor Time");
class WinProcMon
{
public:
WinProcMon():
mQuery(0), mCounter(0) {};
~WinProcMon();
nsresult Init();
nsresult QuerySystemLoad(float* load_percent);
static const uint64_t TicksPerSec = 10000000; //100nsec tick (10MHz)
private:
PDH_HQUERY mQuery;
PDH_HCOUNTER mCounter;
};
WinProcMon::~WinProcMon()
{
if (mQuery != 0) {
PdhCloseQuery(mQuery);
mQuery = 0;
}
}
nsresult
WinProcMon::Init()
{
PDH_HQUERY query;
PDH_HCOUNTER counter;
// Get a query handle to the Performance Data Helper
PDH_STATUS status = PdhOpenQuery(
NULL, // No log file name: use real-time source
0, // zero out user data token: unsued
&query);
if (status != ERROR_SUCCESS) {
LOG(("PdhOpenQuery error = %X", status));
return NS_ERROR_FAILURE;
}
// Add a pre-defined high performance counter to the query.
// This one is for the total CPU usage.
status = PdhAddCounter(query, TotalCounterPath, 0, &counter);
if (status != ERROR_SUCCESS) {
PdhCloseQuery(query);
LOG(("PdhAddCounter (_Total) error = %X", status));
return NS_ERROR_FAILURE;
}
// Need to make an initial query call to set up data capture.
status = PdhCollectQueryData(query);
if (status != ERROR_SUCCESS) {
PdhCloseQuery(query);
LOG(("PdhCollectQueryData (init) error = %X", status));
return NS_ERROR_FAILURE;
}
mQuery = query;
mCounter = counter;
return NS_OK;
}
nsresult WinProcMon::QuerySystemLoad(float* load_percent)
{
*load_percent = 0;
if (mQuery == 0) {
return NS_ERROR_FAILURE;
}
// Update all counters associated with this query object.
PDH_STATUS status = PdhCollectQueryData(mQuery);
if (status != ERROR_SUCCESS) {
LOG(("PdhCollectQueryData error = %X", status));
return NS_ERROR_FAILURE;
}
PDH_FMT_COUNTERVALUE counter;
// maximum is 100% regardless of CPU core count.
status = PdhGetFormattedCounterValue(
mCounter,
PDH_FMT_DOUBLE,
(LPDWORD)NULL,
&counter);
if (ERROR_SUCCESS != status ||
// There are multiple success return values.
!IsSuccessSeverity(counter.CStatus)) {
LOG(("PdhGetFormattedCounterValue error"));
return NS_ERROR_FAILURE;
}
// The result is a percent value, reduce to match expected scale.
*load_percent = (float)(counter.doubleValue / 100.0f);
return NS_OK;
}
#endif
class LoadStats
{
public:
@ -160,7 +276,8 @@ class LoadInfo : public mozilla::RefCounted<LoadInfo>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(LoadInfo)
LoadInfo(int aLoadUpdateInterval);
LoadInfo(): mLoadUpdateInterval(0) {};
nsresult Init(int aLoadUpdateInterval);
double GetSystemLoad() { return mSystemLoad.GetLoad(); };
double GetProcessLoad() { return mProcessLoad.GetLoad(); };
nsresult UpdateSystemLoad();
@ -171,17 +288,29 @@ private:
uint64_t current_total_times,
uint64_t current_cpu_times,
LoadStats* loadStat);
#ifdef XP_WIN
WinProcMon mSysMon;
HANDLE mProcHandle;
int mNumProcessors;
#endif
LoadStats mSystemLoad;
LoadStats mProcessLoad;
uint64_t mTicksPerInterval;
int mLoadUpdateInterval;
};
LoadInfo::LoadInfo(int aLoadUpdateInterval)
: mLoadUpdateInterval(aLoadUpdateInterval)
nsresult LoadInfo::Init(int aLoadUpdateInterval)
{
#if defined(ANDROID) || defined(LINUX)
mLoadUpdateInterval = aLoadUpdateInterval;
#ifdef XP_WIN
mTicksPerInterval = (WinProcMon::TicksPerSec /*Hz*/
* mLoadUpdateInterval /*msec*/) / 1000 ;
mNumProcessors = PR_GetNumberOfProcessors();
mProcHandle = GetCurrentProcess();
return mSysMon.Init();
#else
mTicksPerInterval = (sysconf(_SC_CLK_TCK) * mLoadUpdateInterval) / 1000;
return NS_OK;
#endif
}
@ -189,10 +318,9 @@ void LoadInfo::UpdateCpuLoad(uint64_t ticks_per_interval,
uint64_t current_total_times,
uint64_t current_cpu_times,
LoadStats *loadStat) {
// Check if we get an inconsistent number of ticks.
if (((current_total_times - loadStat->mPrevTotalTimes)
> (ticks_per_interval * 10))
> (ticks_per_interval * 10))
|| current_total_times < loadStat->mPrevTotalTimes
|| current_cpu_times < loadStat->mPrevCpuTimes) {
// Bug at least on the Nexus 4 and Galaxy S4
@ -210,7 +338,11 @@ void LoadInfo::UpdateCpuLoad(uint64_t ticks_per_interval,
const uint64_t cpu_diff = current_cpu_times - loadStat->mPrevCpuTimes;
const uint64_t total_diff = current_total_times - loadStat->mPrevTotalTimes;
if (total_diff > 0) {
#ifdef XP_WIN
float result = (float)cpu_diff / (float)total_diff/ (float)mNumProcessors;
#else
float result = (float)cpu_diff / (float)total_diff;
#endif
loadStat->mPrevLoad = result;
}
loadStat->mPrevTotalTimes = current_total_times;
@ -254,6 +386,36 @@ nsresult LoadInfo::UpdateSystemLoad()
cpu_times,
&mSystemLoad);
return NS_OK;
#elif defined(XP_MACOSX)
mach_msg_type_number_t info_cnt = HOST_CPU_LOAD_INFO_COUNT;
host_cpu_load_info_data_t load_info;
kern_return_t rv = host_statistics(mach_host_self(), HOST_CPU_LOAD_INFO,
(host_info_t)(&load_info), &info_cnt);
if (rv != KERN_SUCCESS || info_cnt != HOST_CPU_LOAD_INFO_COUNT) {
LOG(("Error from mach/host_statistics call"));
return NS_ERROR_FAILURE;
}
const uint64_t cpu_times = load_info.cpu_ticks[CPU_STATE_NICE]
+ load_info.cpu_ticks[CPU_STATE_SYSTEM]
+ load_info.cpu_ticks[CPU_STATE_USER];
const uint64_t total_times = cpu_times + load_info.cpu_ticks[CPU_STATE_IDLE];
UpdateCpuLoad(mTicksPerInterval,
total_times,
cpu_times,
&mSystemLoad);
return NS_OK;
#elif defined(XP_WIN)
float load;
nsresult rv = mSysMon.QuerySystemLoad(&load);
if (rv == NS_OK) {
mSystemLoad.mPrevLoad = load;
}
return rv;
#else
// Not implemented
return NS_OK;
@ -261,7 +423,7 @@ nsresult LoadInfo::UpdateSystemLoad()
}
nsresult LoadInfo::UpdateProcessLoad() {
#if defined(LINUX) || defined(ANDROID)
#if defined(LINUX) || defined(ANDROID) || defined(XP_MACOSX)
struct timeval tv;
gettimeofday(&tv, nullptr);
const uint64_t total_times = tv.tv_sec * PR_USEC_PER_SEC + tv.tv_usec;
@ -280,7 +442,29 @@ nsresult LoadInfo::UpdateProcessLoad() {
total_times,
cpu_times,
&mProcessLoad);
#endif // defined(LINUX) || defined(ANDROID)
#elif defined(XP_WIN)
FILETIME clk_time, sys_time, user_time;
uint64_t total_times, cpu_times;
GetSystemTimeAsFileTime(&clk_time);
total_times = (((uint64_t)clk_time.dwHighDateTime) << 32)
+ (uint64_t)clk_time.dwLowDateTime;
BOOL ok = GetProcessTimes(mProcHandle, &clk_time, &clk_time, &sys_time, &user_time);
if (ok == 0) {
return NS_ERROR_FAILURE;
}
cpu_times = (((uint64_t)sys_time.dwHighDateTime
+ (uint64_t)user_time.dwHighDateTime) << 32)
+ (uint64_t)sys_time.dwLowDateTime
+ (uint64_t)user_time.dwLowDateTime;
UpdateCpuLoad(mTicksPerInterval,
total_times,
cpu_times,
&mProcessLoad);
#endif
return NS_OK;
}
@ -288,12 +472,12 @@ class LoadInfoCollectRunner : public nsRunnable
{
public:
LoadInfoCollectRunner(nsRefPtr<LoadMonitor> loadMonitor,
int aLoadUpdateInterval)
: mLoadUpdateInterval(aLoadUpdateInterval),
RefPtr<LoadInfo> loadInfo)
: mLoadUpdateInterval(loadMonitor->mLoadUpdateInterval),
mLoadNoiseCounter(0)
{
mLoadMonitor = loadMonitor;
mLoadInfo = new LoadInfo(mLoadUpdateInterval);
mLoadInfo = loadInfo;
}
NS_IMETHOD Run()
@ -304,6 +488,7 @@ public:
mLoadInfo->UpdateProcessLoad();
float sysLoad = mLoadInfo->GetSystemLoad();
float procLoad = mLoadInfo->GetProcessLoad();
if ((++mLoadNoiseCounter % (LOG_MANY_ENABLED() ? 1 : 10)) == 0) {
LOG(("System Load: %f Process Load: %f", sysLoad, procLoad));
mLoadNoiseCounter = 0;
@ -362,16 +547,22 @@ LoadMonitor::Init(nsRefPtr<LoadMonitor> &self)
{
LOG(("Initializing LoadMonitor"));
#if defined(ANDROID) || defined(LINUX)
RefPtr<LoadInfo> load_info = new LoadInfo();
nsresult rv = load_info->Init(mLoadUpdateInterval);
if (NS_FAILED(rv)) {
LOG(("LoadInfo::Init error"));
return rv;
}
nsRefPtr<LoadMonitorAddObserver> addObsRunner = new LoadMonitorAddObserver(self);
NS_DispatchToMainThread(addObsRunner, NS_DISPATCH_NORMAL);
NS_NewNamedThread("Sys Load Info", getter_AddRefs(mLoadInfoThread));
nsRefPtr<LoadInfoCollectRunner> runner =
new LoadInfoCollectRunner(self, mLoadUpdateInterval);
new LoadInfoCollectRunner(self, load_info);
mLoadInfoThread->Dispatch(runner, NS_DISPATCH_NORMAL);
#endif
return NS_OK;
}

View File

@ -19,16 +19,13 @@ if CONFIG['MOZ_WEBRTC']:
'LoadMonitor.h',
'MediaEngineWebRTC.h']
UNIFIED_SOURCES += [
'LoadManager.cpp',
'LoadManagerFactory.cpp',
'LoadMonitor.cpp',
'MediaEngineTabVideoSource.cpp',
'MediaEngineWebRTCAudio.cpp',
'MediaEngineWebRTCVideo.cpp',
]
if CONFIG['OS_ARCH'] == 'Android' or CONFIG['OS_ARCH'] == 'Linux':
UNIFIED_SOURCES += [
'LoadManager.cpp',
'LoadMonitor.cpp',
]
# MediaEngineWebRTC.cpp needs to be built separately.
SOURCES += [
'MediaEngineWebRTC.cpp',

View File

@ -100,6 +100,7 @@ function BrowserElementParent(frameLoader, hasRemoteFrame, isPendingFrame) {
debug("Creating new BrowserElementParent object for " + frameLoader);
this._domRequestCounter = 0;
this._pendingDOMRequests = {};
this._pendingSetInputMethodActive = [];
this._hasRemoteFrame = hasRemoteFrame;
this._nextPaintListeners = [];
@ -371,6 +372,11 @@ BrowserElementParent.prototype = {
this._ready = true;
// Handle pending SetInputMethodActive request.
while (this._pendingSetInputMethodActive.length > 0) {
this._setInputMethodActive(this._pendingSetInputMethodActive.shift());
}
// Inform our child if our owner element's document is invisible. Note
// that we must do so here, rather than in the BrowserElementParent
// constructor, because the BrowserElementChild may not be initialized when
@ -724,6 +730,12 @@ BrowserElementParent.prototype = {
Cr.NS_ERROR_INVALID_ARG);
}
// Wait until browserElementChild is initialized.
if (!this._ready) {
this._pendingSetInputMethodActive.push(isActive);
return;
}
let req = Services.DOMRequest.createRequest(this._window);
// Deactivate the old input method if needed.
@ -733,35 +745,17 @@ BrowserElementParent.prototype = {
// we should simply set it to null directly.
activeInputFrame = null;
this._sendSetInputMethodActiveDOMRequest(req, isActive);
} else {
let reqOld = XPCNativeWrapper.unwrap(activeInputFrame)
.setInputMethodActive(false);
// We wan't to continue regardless whether this req succeeded
reqOld.onsuccess = reqOld.onerror = function() {
let setActive = function() {
activeInputFrame = null;
this._sendSetInputMethodActiveDOMRequest(req, isActive);
}.bind(this);
if (this._ready) {
setActive();
return;
}
// Wait for the hello event from BrowserElementChild
let onReady = function(aMsg) {
if (this._isAlive() && (aMsg.data.msg_name === 'hello')) {
setActive();
this._mm.removeMessageListener('browser-element-api:call',
onReady);
}
}.bind(this);
this._mm.addMessageListener('browser-element-api:call', onReady);
}.bind(this);
return req;
}
let reqOld = XPCNativeWrapper.unwrap(activeInputFrame)
.setInputMethodActive(false);
// We wan't to continue regardless whether this req succeeded
reqOld.onsuccess = reqOld.onerror = function() {
activeInputFrame = null;
this._sendSetInputMethodActiveDOMRequest(req, isActive);
}.bind(this);
} else {
this._sendSetInputMethodActiveDOMRequest(req, isActive);
}

View File

@ -172,19 +172,20 @@ GonkCameraHardware::Init()
// Disable shutter sound in android CameraService because gaia camera app will play it
mCamera->sendCommand(CAMERA_CMD_ENABLE_SHUTTER_SOUND, 0, 0);
mNativeWindow = new GonkNativeWindow();
mNativeWindow->setNewFrameCallback(this);
mCamera->setListener(this);
#if defined(MOZ_WIDGET_GONK)
#if ANDROID_VERSION >= 19
mNativeWindow = new GonkNativeWindow(GonkCameraHardware::MIN_UNDEQUEUED_BUFFERS);
mCamera->setPreviewTarget(mNativeWindow->getBufferQueue());
#elif (ANDROID_VERSION == 17) || (ANDROID_VERSION == 18)
#elif ANDROID_VERSION >= 17
mNativeWindow = new GonkNativeWindow();
mCamera->setPreviewTexture(mNativeWindow->getBufferQueue());
#else
mNativeWindow = new GonkNativeWindow();
mCamera->setPreviewTexture(mNativeWindow);
#endif
mNativeWindow->setNewFrameCallback(this);
mCamera->setListener(this);
#if ANDROID_VERSION >= 16
rv = mCamera->sendCommand(CAMERA_CMD_ENABLE_FOCUS_MOVE_MSG, 1, 0);

View File

@ -83,6 +83,15 @@ public:
};
virtual int GetSensorOrientation(uint32_t aType = RAW_SENSOR_ORIENTATION);
/**
* MIN_UNDEQUEUED_BUFFERS has increased to 4 since Android JB. For FFOS, more
* than 3 gralloc buffers are necessary between ImageHost and GonkBufferQueue
* for consuming preview stream. To keep the stability for older platform, we
* set MIN_UNDEQUEUED_BUFFERS to 4 only in Android KK base.
* See also bug 988704.
*/
enum { MIN_UNDEQUEUED_BUFFERS = 4};
virtual int AutoFocus();
virtual int CancelAutoFocus();
virtual int StartFaceDetection();

View File

@ -32,7 +32,7 @@ let WindowMap = {
if (!this._map || !win) {
return false;
}
return this._map.get(win, false);
return this._map.get(win) || false;
},
/*

View File

@ -10,6 +10,13 @@ CSPViolation = The page's settings blocked the loading of a resource: %1$S
# %1$S is the directive that has been violated.
# %2$S is the URI of the resource which violated the directive.
CSPViolationWithURI = The page's settings blocked the loading of a resource at %2$S ("%1$S").
# LOCALIZATION NOTE (CSPROViolation):
# %1$S is the reason why the resource has not been loaded.
CSPROViolation = A violation occurred for a report-only CSP policy ("%1$S"). The behavior was allowed, and a CSP report was sent.
# LOCALIZATION NOTE (CSPROViolationWithURI):
# %1$S is the directive that has been violated.
# %2$S is the URI of the resource which violated the directive.
CSPROViolationWithURI = The page's settings observed the loading of a resource at %2$S ("%1$S"). A CSP report is being sent.
# LOCALIZATION NOTE (triedToSendReport):
# %1$S is the URI we attempted to send a report to.
triedToSendReport = Tried to send report to invalid URI: "%1$S"

View File

@ -29,6 +29,7 @@ nsSMILAnimationController::nsSMILAnimationController(nsIDocument* aDoc)
mResampleNeeded(false),
mDeferredStartSampling(false),
mRunningSample(false),
mRegisteredWithRefreshDriver(false),
mDocument(aDoc)
{
NS_ABORT_IF_FALSE(aDoc, "need a non-null document");
@ -49,6 +50,8 @@ nsSMILAnimationController::~nsSMILAnimationController()
NS_ASSERTION(mAnimationElementTable.Count() == 0,
"Animation controller shouldn't be tracking any animation"
" elements when it dies");
NS_ASSERTION(!mRegisteredWithRefreshDriver,
"Leaving stale entry in refresh driver's observer list");
}
void
@ -90,8 +93,8 @@ nsSMILAnimationController::Resume(uint32_t aType)
nsSMILTimeContainer::Resume(aType);
if (wasPaused && !mPauseState && mChildContainerTable.Count()) {
Sample(); // Run the first sample manually
MaybeStartSampling(GetRefreshDriver());
Sample(); // Run the first sample manually
}
}
@ -260,6 +263,8 @@ nsSMILAnimationController::StartSampling(nsRefreshDriver* aRefreshDriver)
NS_ASSERTION(!mDeferredStartSampling,
"Started sampling but the deferred start flag is still set");
if (aRefreshDriver) {
MOZ_ASSERT(!mRegisteredWithRefreshDriver,
"Redundantly registering with refresh driver");
NS_ABORT_IF_FALSE(!GetRefreshDriver() ||
aRefreshDriver == GetRefreshDriver(),
"Starting sampling with wrong refresh driver");
@ -267,19 +272,21 @@ nsSMILAnimationController::StartSampling(nsRefreshDriver* aRefreshDriver)
// or else it will confuse our "average time between samples" calculations.
mCurrentSampleTime = mozilla::TimeStamp::Now();
aRefreshDriver->AddRefreshObserver(this, Flush_Style);
mRegisteredWithRefreshDriver = true;
}
}
void
nsSMILAnimationController::StopSampling(nsRefreshDriver* aRefreshDriver)
{
if (aRefreshDriver) {
if (aRefreshDriver && mRegisteredWithRefreshDriver) {
// NOTE: The document might already have been detached from its PresContext
// (and RefreshDriver), which would make GetRefreshDriverForDoc return null.
// (and RefreshDriver), which would make GetRefreshDriver() return null.
NS_ABORT_IF_FALSE(!GetRefreshDriver() ||
aRefreshDriver == GetRefreshDriver(),
"Stopping sampling with wrong refresh driver");
aRefreshDriver->RemoveRefreshObserver(this, Flush_Style);
mRegisteredWithRefreshDriver = false;
}
}

View File

@ -214,6 +214,9 @@ protected:
bool mDeferredStartSampling;
bool mRunningSample;
// Are we registered with our document's refresh driver?
bool mRegisteredWithRefreshDriver;
// Store raw ptr to mDocument. It owns the controller, so controller
// shouldn't outlive it
nsIDocument* mDocument;

View File

@ -6,6 +6,7 @@
#ifndef NS_SMILCOMPOSITOR_H_
#define NS_SMILCOMPOSITOR_H_
#include "mozilla/Move.h"
#include "nsTHashtable.h"
#include "nsString.h"
#include "nsSMILAnimationFunction.h"
@ -65,7 +66,7 @@ public:
// Transfers |aOther|'s mCachedBaseValue to |this|
void StealCachedBaseValue(nsSMILCompositor* aOther) {
mCachedBaseValue = aOther->mCachedBaseValue;
mCachedBaseValue = mozilla::Move(aOther->mCachedBaseValue);
}
private:

View File

@ -6,6 +6,7 @@
#ifndef NS_SMILTIMEDELEMENT_H_
#define NS_SMILTIMEDELEMENT_H_
#include "mozilla/Move.h"
#include "nsSMILInterval.h"
#include "nsSMILInstanceTime.h"
#include "nsSMILMilestone.h"
@ -524,7 +525,7 @@ protected:
{
if (mCurrentInterval) {
// Transfer ownership to temp var. (This sets mCurrentInterval to null.)
nsAutoPtr<nsSMILInterval> interval(mCurrentInterval);
nsAutoPtr<nsSMILInterval> interval(mozilla::Move(mCurrentInterval));
interval->Unlink();
}
}

View File

@ -193,6 +193,7 @@ let NotificationDB = {
this.queueTask("getall", message.data, function(notifications) {
returnMessage("Notification:GetAll:Return:OK", {
requestID: message.data.requestID,
origin: message.data.origin,
notifications: notifications
});
});

View File

@ -47,19 +47,24 @@ NotificationStorage.prototype = {
tag: tag,
icon: icon,
alertName: alertName,
timestamp: new Date().getTime()
timestamp: new Date().getTime(),
origin: origin
};
this._notifications[id] = notification;
if (tag) {
if (!this._byTag[origin]) {
this._byTag[origin] = {};
}
// We might have existing notification with this tag,
// if so we need to remove it from our cache.
if (this._byTag[tag]) {
var oldNotification = this._byTag[tag];
if (this._byTag[origin][tag]) {
var oldNotification = this._byTag[origin][tag];
delete this._notifications[oldNotification.id];
}
this._byTag[tag] = notification;
this._byTag[origin][tag] = notification;
};
cpmm.sendAsyncMessage("Notification:Save", {
@ -69,9 +74,9 @@ NotificationStorage.prototype = {
},
get: function(origin, tag, callback) {
if (DEBUG) { debug("GET: " + tag); }
if (DEBUG) { debug("GET: " + origin + " " + tag); }
if (this._cached) {
this._fetchFromCache(tag, callback);
this._fetchFromCache(origin, tag, callback);
} else {
this._fetchFromDB(origin, tag, callback);
}
@ -82,7 +87,7 @@ NotificationStorage.prototype = {
var notification = this._notifications[id];
if (notification) {
if (notification.tag) {
delete this._byTag[notification.tag];
delete this._byTag[origin][notification.tag];
}
delete this._notifications[id];
}
@ -99,7 +104,7 @@ NotificationStorage.prototype = {
var request = this._requests[message.data.requestID];
delete this._requests[message.data.requestID];
this._populateCache(message.data.notifications);
this._fetchFromCache(request.tag, request.callback);
this._fetchFromCache(request.origin, request.tag, request.callback);
break;
default:
@ -122,16 +127,18 @@ NotificationStorage.prototype = {
});
},
_fetchFromCache: function(tag, callback) {
_fetchFromCache: function(origin, tag, callback) {
var notifications = [];
// If a tag was specified and we have a notification
// with this tag, return that. If no tag was specified
// simple return all stored notifications.
if (tag && this._byTag[tag]) {
notifications.push(this._byTag[tag]);
if (tag && this._byTag[origin] && this._byTag[origin][tag]) {
notifications.push(this._byTag[origin][tag]);
} else if (!tag) {
for (var id in this._notifications) {
notifications.push(this._notifications[id]);
if (this._notifications[id].origin === origin) {
notifications.push(this._notifications[id]);
}
}
}
@ -159,8 +166,13 @@ NotificationStorage.prototype = {
_populateCache: function(notifications) {
notifications.forEach(function(notification) {
this._notifications[notification.id] = notification;
if (notification.tag) {
this._byTag[notification.tag] = notification;
if (notification.tag && notification.origin) {
let tag = notification.tag;
let origin = notification.origin;
if (!this._byTag[origin]) {
this._byTag[origin] = {};
}
this._byTag[origin][tag] = notification;
}
}.bind(this));
this._cached = true;

View File

@ -205,6 +205,134 @@ BufObject.prototype = {
}
})();
const TELEPHONY_REQUESTS = [
REQUEST_GET_CURRENT_CALLS,
REQUEST_ANSWER,
REQUEST_CONFERENCE,
REQUEST_DIAL,
REQUEST_DIAL_EMERGENCY_CALL,
REQUEST_HANGUP,
REQUEST_HANGUP_WAITING_OR_BACKGROUND,
REQUEST_SEPARATE_CONNECTION,
REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE,
REQUEST_UDUB
];
function TelephonyRequestEntry(request, action, options) {
this.request = request;
this.action = action;
this.options = options;
}
function TelephonyRequestQueue(ril) {
this.ril = ril;
this.currentQueue = null; // Point to the current running queue.
this.queryQueue = [];
this.controlQueue = [];
}
TelephonyRequestQueue.prototype = {
ril: null,
_getQueue: function(request) {
return (request === REQUEST_GET_CURRENT_CALLS) ? this.queryQueue
: this.controlQueue;
},
_getAnotherQueue: function(queue) {
return (this.queryQueue === queue) ? this.controlQueue : this.queryQueue;
},
_find: function(queue, request) {
for (let i = 0; i < queue.length; ++i) {
if (queue[i].request === request) {
return i;
}
}
return -1;
},
_startQueue: function(queue) {
if (queue.length === 0) {
return;
}
// We only need to keep one entry for queryQueue.
if (queue === this.queryQueue) {
queue.splice(1, queue.length - 1);
}
this.currentQueue = queue;
for (let entry of queue) {
this._executeEntry(entry);
}
},
_executeEntry: function(entry) {
if (DEBUG) this.debug("execute " + this._getRequestName(entry.request));
entry.action.call(this.ril, entry.options);
},
_getRequestName: function(request) {
let method = this.ril[request];
return (typeof method === 'function') ? method.name : "";
},
debug: function(msg) {
this.ril.context.debug("[TeleQ] " + msg);
},
isValidRequest: function(request) {
return TELEPHONY_REQUESTS.indexOf(request) !== -1;
},
push: function(request, action, options) {
if (!this.isValidRequest(request)) {
if (DEBUG) {
this.debug("Error: " + this._getRequestName(request) +
" is not a telephony request");
}
return;
}
if (DEBUG) this.debug("push " + this._getRequestName(request));
let entry = new TelephonyRequestEntry(request, action, options);
let queue = this._getQueue(request);
queue.push(entry);
// Try to run the request.
if (this.currentQueue === queue) {
this._executeEntry(entry);
} else if (!this.currentQueue) {
this._startQueue(queue);
}
},
pop: function(request) {
if (!this.isValidRequest(request)) {
if (DEBUG) {
this.debug("Error: " + this._getRequestName(request) +
" is not a telephony request");
}
return;
}
if (DEBUG) this.debug("pop " + this._getRequestName(request));
let queue = this._getQueue(request);
let index = this._find(queue, request);
if (index === -1) {
throw new Error("Cannot find the request in telephonyRequestQueue.");
} else {
queue.splice(index, 1);
}
if (queue.length === 0) {
this.currentQueue = null;
this._startQueue(this._getAnotherQueue(queue));
}
}
};
/**
* The RIL state machine.
*
@ -215,6 +343,7 @@ BufObject.prototype = {
function RilObject(aContext) {
this.context = aContext;
this.telephonyRequestQueue = new TelephonyRequestQueue(this);
this.currentCalls = {};
this.currentConference = {state: null, participants: {}};
this.currentDataCalls = {};
@ -1361,6 +1490,11 @@ RilObject.prototype = {
* Get current calls.
*/
getCurrentCalls: function() {
this.telephonyRequestQueue.push(REQUEST_GET_CURRENT_CALLS,
this.sendRilRequestGetCurrentCalls, null);
},
sendRilRequestGetCurrentCalls: function() {
this.context.Buf.simpleRequest(REQUEST_GET_CURRENT_CALLS);
},
@ -1506,6 +1640,11 @@ RilObject.prototype = {
},
sendDialRequest: function(options) {
this.telephonyRequestQueue.push(options.request, this.sendRilRequestDial,
options);
},
sendRilRequestDial: function(options) {
// Always succeed.
options.success = true;
this.sendChromeMessage(options);
@ -1563,13 +1702,18 @@ RilObject.prototype = {
call.hangUpLocal = true;
if (call.state === CALL_STATE_HOLDING) {
this.sendHangUpBackgroundRequest(callIndex);
this.sendHangUpBackgroundRequest();
} else {
this.sendHangUpRequest(callIndex);
}
},
sendHangUpRequest: function(callIndex) {
this.telephonyRequestQueue.push(REQUEST_HANGUP, this.sendRilRequestHangUp,
callIndex);
},
sendRilRequestHangUp: function(callIndex) {
let Buf = this.context.Buf;
Buf.newParcel(REQUEST_HANGUP);
Buf.writeInt32(1);
@ -1577,9 +1721,13 @@ RilObject.prototype = {
Buf.sendParcel();
},
sendHangUpBackgroundRequest: function(callIndex) {
let Buf = this.context.Buf;
Buf.simpleRequest(REQUEST_HANGUP_WAITING_OR_BACKGROUND);
sendHangUpBackgroundRequest: function() {
this.telephonyRequestQueue.push(REQUEST_HANGUP_WAITING_OR_BACKGROUND,
this.sendRilRequestHangUpWaiting, null);
},
sendRilRequestHangUpWaiting: function() {
this.context.Buf.simpleRequest(REQUEST_HANGUP_WAITING_OR_BACKGROUND);
},
/**
@ -1612,18 +1760,31 @@ RilObject.prototype = {
return;
}
let Buf = this.context.Buf;
switch (call.state) {
case CALL_STATE_INCOMING:
Buf.simpleRequest(REQUEST_ANSWER);
this.telephonyRequestQueue.push(REQUEST_ANSWER, this.sendRilRequestAnswer,
null);
break;
case CALL_STATE_WAITING:
// Answer the waiting (second) call, and hold the first call.
Buf.simpleRequest(REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE);
this.sendSwitchWaitingRequest();
break;
}
},
sendRilRequestAnswer: function() {
this.context.Buf.simpleRequest(REQUEST_ANSWER);
},
sendSwitchWaitingRequest: function() {
this.telephonyRequestQueue.push(REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE,
this.sendRilRequestSwitch, null);
},
sendRilRequestSwitch: function() {
this.context.Buf.simpleRequest(REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE);
},
/**
* Reject an incoming/waiting call.
*
@ -1642,24 +1803,28 @@ RilObject.prototype = {
call.hangUpLocal = true;
let Buf = this.context.Buf;
if (this._isCdma) {
// AT+CHLD=0 means "release held or UDUB."
Buf.simpleRequest(REQUEST_HANGUP_WAITING_OR_BACKGROUND);
this.sendHangUpBackgroundRequest();
return;
}
switch (call.state) {
case CALL_STATE_INCOMING:
Buf.simpleRequest(REQUEST_UDUB);
this.telephonyRequestQueue.push(REQUEST_UDUB, this.sendRilRequestUdub,
null);
break;
case CALL_STATE_WAITING:
// Reject the waiting (second) call, and remain the first call.
Buf.simpleRequest(REQUEST_HANGUP_WAITING_OR_BACKGROUND);
this.sendHangUpBackgroundRequest();
break;
}
},
sendRilRequestUdub: function() {
this.context.Buf.simpleRequest(REQUEST_UDUB);
},
holdCall: function(options) {
let call = this.currentCalls[options.callIndex];
if (!call) {
@ -1674,7 +1839,7 @@ RilObject.prototype = {
options.featureStr = "";
this.sendCdmaFlashCommand(options);
} else if (call.state == CALL_STATE_ACTIVE) {
Buf.simpleRequest(REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE, options);
this.sendSwitchWaitingRequest();
}
},
@ -1692,7 +1857,7 @@ RilObject.prototype = {
options.featureStr = "";
this.sendCdmaFlashCommand(options);
} else if (call.state == CALL_STATE_HOLDING) {
Buf.simpleRequest(REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE, options);
this.sendSwitchWaitingRequest();
}
},
@ -1700,16 +1865,20 @@ RilObject.prototype = {
_hasConferenceRequest: false,
conferenceCall: function(options) {
let Buf = this.context.Buf;
if (this._isCdma) {
options.featureStr = "";
this.sendCdmaFlashCommand(options);
} else {
this._hasConferenceRequest = true;
Buf.simpleRequest(REQUEST_CONFERENCE, options);
this.telephonyRequestQueue.push(REQUEST_CONFERENCE,
this.sendRilRequestConference, options);
}
},
sendRilRequestConference: function(options) {
this.context.Buf.simpleRequest(REQUEST_CONFERENCE, options);
},
separateCall: function(options) {
let call = this.currentCalls[options.callIndex];
if (!call) {
@ -1720,24 +1889,30 @@ RilObject.prototype = {
return;
}
let Buf = this.context.Buf;
if (this._isCdma) {
options.featureStr = "";
this.sendCdmaFlashCommand(options);
} else {
Buf.newParcel(REQUEST_SEPARATE_CONNECTION, options);
Buf.writeInt32(1);
Buf.writeInt32(options.callIndex);
Buf.sendParcel();
this.telephonyRequestQueue.push(REQUEST_SEPARATE_CONNECTION,
this.sendRilRequestSeparateConnection,
options);
}
},
sendRilRequestSeparateConnection: function(options) {
let Buf = this.context.Buf;
Buf.newParcel(REQUEST_SEPARATE_CONNECTION, options);
Buf.writeInt32(1);
Buf.writeInt32(options.callIndex);
Buf.sendParcel();
},
holdConference: function() {
if (this._isCdma) {
return;
}
this.context.Buf.simpleRequest(REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE);
this.sendSwitchWaitingRequest();
},
resumeConference: function() {
@ -1745,7 +1920,7 @@ RilObject.prototype = {
return;
}
this.context.Buf.simpleRequest(REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE);
this.sendSwitchWaitingRequest();
},
/**
@ -5262,6 +5437,10 @@ RilObject.prototype = {
if (DEBUG) this.context.debug("Handling parcel as " + method.name);
method.call(this, length, options);
}
if (this.telephonyRequestQueue.isValidRequest(request_type)) {
this.telephonyRequestQueue.pop(request_type);
}
}
};
@ -5396,7 +5575,9 @@ RilObject.prototype[REQUEST_DIAL] = function REQUEST_DIAL(length, options) {
}).bind(this));
}
};
RilObject.prototype[REQUEST_DIAL_EMERGENCY_CALL] = RilObject.prototype[REQUEST_DIAL];
RilObject.prototype[REQUEST_DIAL_EMERGENCY_CALL] = function REQUEST_DIAL_EMERGENCY_CALL(length, options) {
RilObject.prototype[REQUEST_DIAL](length, options);
};
RilObject.prototype[REQUEST_GET_IMSI] = function REQUEST_GET_IMSI(length, options) {
if (options.rilRequestError) {
return;
@ -5425,6 +5606,7 @@ RilObject.prototype[REQUEST_HANGUP_WAITING_OR_BACKGROUND] = function REQUEST_HAN
this.getCurrentCalls();
};
// TODO Bug 1012599: This one is not used.
RilObject.prototype[REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND] = function REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND(length, options) {
if (options.rilRequestError) {
return;
@ -5433,14 +5615,10 @@ RilObject.prototype[REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND] = function REQU
this.getCurrentCalls();
};
RilObject.prototype[REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE] = function REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE(length, options) {
options.success = (options.rilRequestError === 0);
if (!options.success) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
this.sendChromeMessage(options);
if (options.rilRequestError) {
return;
}
this.sendChromeMessage(options);
this.getCurrentCalls();
};
RilObject.prototype[REQUEST_CONFERENCE] = function REQUEST_CONFERENCE(length, options) {
@ -5455,7 +5633,8 @@ RilObject.prototype[REQUEST_CONFERENCE] = function REQUEST_CONFERENCE(length, op
this.sendChromeMessage(options);
};
RilObject.prototype[REQUEST_UDUB] = null;
RilObject.prototype[REQUEST_UDUB] = function REQUEST_UDUB(length, options) {
};
RilObject.prototype[REQUEST_LAST_CALL_FAIL_CAUSE] = function REQUEST_LAST_CALL_FAIL_CAUSE(length, options) {
let Buf = this.context.Buf;
let num = length ? Buf.readInt32() : 0;
@ -5861,7 +6040,8 @@ RilObject.prototype[REQUEST_GET_IMEISV] = function REQUEST_GET_IMEISV(length, op
this.IMEISV = this.context.Buf.readString();
};
RilObject.prototype[REQUEST_ANSWER] = null;
RilObject.prototype[REQUEST_ANSWER] = function REQUEST_ANSWER(length, options) {
};
RilObject.prototype[REQUEST_DEACTIVATE_DATA_CALL] = function REQUEST_DEACTIVATE_DATA_CALL(length, options) {
if (options.rilRequestError) {
return;

View File

@ -748,7 +748,6 @@ TelephonyProvider.prototype = {
gSystemMessenger.broadcastMessage("telephony-call-ended", data);
aCall.clientId = aClientId;
this._updateActiveCall(aCall, null);
let manualConfStateChange = false;
let childId = this._currentCalls[aClientId][aCall.callIndex].childId;
@ -775,6 +774,8 @@ TelephonyProvider.prototype = {
}
}
this._updateActiveCall(aCall, null);
if (!aCall.failCause ||
aCall.failCause === RIL.GECKO_CALL_ERROR_NORMAL_CALL_CLEARING) {
this._notifyAllListeners("callStateChanged", [aClientId,

View File

@ -50,36 +50,6 @@ let emulator = (function() {
};
}());
// Delay 1s before each telephony.dial()
// The workaround here should be removed after bug 1005816.
let originalDial;
function delayTelephonyDial() {
originalDial = telephony.dial;
telephony.dial = function(number, serviceId) {
let deferred = Promise.defer();
let startTime = Date.now();
waitFor(function() {
originalDial.call(telephony, number, serviceId).then(call => {
deferred.resolve(call);
}, cause => {
deferred.reject(cause);
});
}, function() {
duration = Date.now() - startTime;
return (duration >= 1000);
});
return deferred.promise;
};
}
function restoreTelephonyDial() {
telephony.dial = originalDial;
}
/**
* Telephony related helper functions.
*/
@ -1097,7 +1067,6 @@ function _startTest(permissions, test) {
// Make sure that we get the telephony after adding permission.
telephony = window.navigator.mozTelephony;
ok(telephony);
delayTelephonyDial();
conference = telephony.conferenceGroup;
ok(conference);
return gClearCalls().then(gCheckInitialState);
@ -1109,7 +1078,6 @@ function _startTest(permissions, test) {
function tearDown() {
log("== Test TearDown ==");
restoreTelephonyDial();
emulator.waitFinish()
.then(() => {
permissionTearDown();

View File

@ -4,120 +4,28 @@
MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = 'head.js';
let number;
let emergency;
let outgoing;
function testEmergencyLabel(number, emergency) {
log("= testEmergencyLabel = " + number + " should be " +
(emergency ? "emergency" : "normal") + " call");
let testCase = 0;
let expectedResults = [
["112", true],
["911", true],
["0912345678", false],
["777", false],
];
let outCall;
function createGoldenCallListResult0(number, state) {
// "outbound to xxxxxxxxxx : ringing"
let padPattern = " ";
let pad = padPattern.substring(0, padPattern.length - number.length);
return "outbound to " + number + pad + " : " + state;
}
function dial() {
log("Make an outgoing call.");
telephony.dial(number).then(call => {
outgoing = call;
ok(outgoing);
is(outgoing.number, number);
is(outgoing.state, "dialing");
is(outgoing, telephony.active);
is(telephony.calls.length, 1);
is(telephony.calls[0], outgoing);
outgoing.onalerting = function onalerting(event) {
log("Received 'onalerting' call event.");
is(outgoing, event.call);
is(outgoing.state, "alerting");
is(outgoing.emergency, emergency);
emulator.run("gsm list", function(result) {
log("Call list is now: " + result);
is(result[0], createGoldenCallListResult0(number, "ringing"));
is(result[1], "OK");
answer();
});
};
});
}
function answer() {
log("Answering the call.");
// We get no "connecting" event when the remote party answers the call.
outgoing.onconnected = function onconnected(event) {
log("Received 'connected' call event.");
is(outgoing, event.call);
is(outgoing.state, "connected");
is(outgoing.emergency, emergency);
is(outgoing, telephony.active);
emulator.run("gsm list", function(result) {
log("Call list is now: " + result);
is(result[0], createGoldenCallListResult0(number, "active"));
is(result[1], "OK");
hangUp();
});
};
emulator.run("gsm accept " + number);
}
function hangUp() {
log("Hanging up the call.");
// We get no "disconnecting" event when the remote party terminates the call.
outgoing.ondisconnected = function ondisconnected(event) {
log("Received 'disconnected' call event.");
is(outgoing, event.call);
is(outgoing.state, "disconnected");
is(outgoing.emergency, emergency);
is(telephony.active, null);
is(telephony.calls.length, 0);
emulator.run("gsm list", function(result) {
log("Call list is now: " + result);
is(result[0], "OK");
verifyNextEmergencyLabel();
});
};
emulator.run("gsm cancel " + number);
}
function cleanUp() {
finish();
}
function verifyNextEmergencyLabel() {
if (testCase >= expectedResults.length) {
cleanUp();
} else {
log("Running test case: " + testCase + "/" + expectedResults.length);
number = expectedResults[testCase][0];
emergency = expectedResults[testCase][1];
testCase++;
// No more calls in the list; give time for emulator to catch up
waitFor(dial, function() {
return (telephony.calls.length === 0);
});
}
return gDial(number)
.then(call => { outCall = call; })
.then(() => {
is(outCall.emergency, emergency, "emergency result should be correct");
})
.then(() => gRemoteAnswer(outCall))
.then(() => {
is(outCall.emergency, emergency, "emergency result should be correct");
})
.then(() => gRemoteHangUp(outCall));
}
startTest(function() {
verifyNextEmergencyLabel();
testEmergencyLabel("112", true)
.then(() => testEmergencyLabel("911", true))
.then(() => testEmergencyLabel("0912345678", false))
.then(() => testEmergencyLabel("777", false))
.then(finish);
});

View File

@ -781,7 +781,9 @@ ScriptExecutorRunnable::PostRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate,
NS_IMETHODIMP
ScriptExecutorRunnable::Cancel()
{
ShutdownScriptLoader(mWorkerPrivate->GetJSContext(), mWorkerPrivate, false);
if (mLastIndex == mScriptLoader.mLoadInfos.Length() - 1) {
ShutdownScriptLoader(mWorkerPrivate->GetJSContext(), mWorkerPrivate, false);
}
return MainThreadWorkerSyncRunnable::Cancel();
}

View File

@ -4,6 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/XPathEvaluator.h"
#include "mozilla/Move.h"
#include "nsCOMPtr.h"
#include "nsIAtom.h"
#include "nsXPathExpression.h"
@ -129,7 +130,7 @@ XPathEvaluator::CreateExpression(const nsAString & aExpression,
nsCOMPtr<nsIDOMDocument> document = do_QueryReferent(mDocument);
*aResult = new nsXPathExpression(expression, mRecycler, document);
*aResult = new nsXPathExpression(Move(expression), mRecycler, document);
if (!*aResult) {
return NS_ERROR_OUT_OF_MEMORY;
}

View File

@ -3,6 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/Move.h"
#include "nsXPathExpression.h"
#include "txExpr.h"
#include "txExprResult.h"
@ -14,6 +15,8 @@
#include "txURIUtils.h"
#include "txXPathTreeWalker.h"
using mozilla::Move;
NS_IMPL_CYCLE_COLLECTION(nsXPathExpression, mDocument)
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsXPathExpression)
@ -28,10 +31,10 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXPathExpression)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(XPathExpression)
NS_INTERFACE_MAP_END
nsXPathExpression::nsXPathExpression(nsAutoPtr<Expr>& aExpression,
nsXPathExpression::nsXPathExpression(nsAutoPtr<Expr>&& aExpression,
txResultRecycler* aRecycler,
nsIDOMDocument *aDocument)
: mExpression(aExpression),
: mExpression(Move(aExpression)),
mRecycler(aRecycler),
mDocument(aDocument)
{

View File

@ -24,7 +24,7 @@ class nsXPathExpression MOZ_FINAL : public nsIDOMXPathExpression,
public nsIDOMNSXPathExpression
{
public:
nsXPathExpression(nsAutoPtr<Expr>& aExpression, txResultRecycler* aRecycler,
nsXPathExpression(nsAutoPtr<Expr>&& aExpression, txResultRecycler* aRecycler,
nsIDOMDocument *aDocument);
// nsISupports interface

View File

@ -9,6 +9,7 @@
* @see ExprLexer
**/
#include "mozilla/Move.h"
#include "txExprParser.h"
#include "txExprLexer.h"
#include "txExpr.h"
@ -20,6 +21,8 @@
#include "txXPathNode.h"
#include "txXPathOptimizer.h"
using mozilla::Move;
/**
* Creates an Attribute Value Template using the given value
* This should move to XSLProcessor class
@ -113,7 +116,7 @@ txExprParser::createAVT(const nsSubstring& aAttrValue,
// Add expression, create a concat() call if necessary
if (!expr) {
expr = newExpr;
expr = Move(newExpr);
}
else {
if (!concat) {
@ -311,7 +314,7 @@ txExprParser::createExpr(txExprLexer& lexer, txIParseContext* aContext,
<= precedence(static_cast<Token*>(ops.peek()))) {
// can't use expr as argument due to order of evaluation
nsAutoPtr<Expr> left(static_cast<Expr*>(exprs.pop()));
nsAutoPtr<Expr> right(expr);
nsAutoPtr<Expr> right(Move(expr));
rv = createBinaryExpr(left, right,
static_cast<Token*>(ops.pop()),
getter_Transfers(expr));
@ -330,7 +333,7 @@ txExprParser::createExpr(txExprLexer& lexer, txIParseContext* aContext,
while (NS_SUCCEEDED(rv) && !exprs.isEmpty()) {
nsAutoPtr<Expr> left(static_cast<Expr*>(exprs.pop()));
nsAutoPtr<Expr> right(expr);
nsAutoPtr<Expr> right(Move(expr));
rv = createBinaryExpr(left, right, static_cast<Token*>(ops.pop()),
getter_Transfers(expr));
}

View File

@ -3,6 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/Move.h"
#include "txInstructions.h"
#include "nsError.h"
#include "txExpr.h"
@ -18,6 +19,8 @@
#include "txXSLTNumber.h"
#include "txExecutionState.h"
using mozilla::Move;
nsresult
txApplyDefaultElementTemplate::execute(txExecutionState& aEs)
{
@ -86,11 +89,9 @@ txApplyTemplates::execute(txExecutionState& aEs)
return aEs.runTemplate(templ);
}
txAttribute::txAttribute(nsAutoPtr<Expr> aName, nsAutoPtr<Expr> aNamespace,
txAttribute::txAttribute(nsAutoPtr<Expr>&& aName, nsAutoPtr<Expr>&& aNamespace,
txNamespaceMap* aMappings)
: mName(aName),
mNamespace(aNamespace),
mMappings(aMappings)
: mName(Move(aName)), mNamespace(Move(aNamespace)), mMappings(aMappings)
{
}
@ -179,10 +180,9 @@ txCheckParam::execute(txExecutionState& aEs)
return NS_OK;
}
txConditionalGoto::txConditionalGoto(nsAutoPtr<Expr> aCondition,
txConditionalGoto::txConditionalGoto(nsAutoPtr<Expr>&& aCondition,
txInstruction* aTarget)
: mCondition(aCondition),
mTarget(aTarget)
: mCondition(Move(aCondition)), mTarget(aTarget)
{
}
@ -365,8 +365,8 @@ txCopy::execute(txExecutionState& aEs)
return NS_OK;
}
txCopyOf::txCopyOf(nsAutoPtr<Expr> aSelect)
: mSelect(aSelect)
txCopyOf::txCopyOf(nsAutoPtr<Expr>&& aSelect)
: mSelect(Move(aSelect))
{
}
@ -486,11 +486,11 @@ txLoopNodeSet::execute(txExecutionState& aEs)
}
txLREAttribute::txLREAttribute(int32_t aNamespaceID, nsIAtom* aLocalName,
nsIAtom* aPrefix, nsAutoPtr<Expr> aValue)
nsIAtom* aPrefix, nsAutoPtr<Expr>&& aValue)
: mNamespaceID(aNamespaceID),
mLocalName(aLocalName),
mPrefix(aPrefix),
mValue(aValue)
mValue(Move(aValue))
{
if (aNamespaceID == kNameSpaceID_None) {
mLowercaseLocalName = TX_ToLowerCaseAtom(aLocalName);
@ -541,13 +541,17 @@ txMessage::execute(txExecutionState& aEs)
return mTerminate ? NS_ERROR_XSLT_ABORTED : NS_OK;
}
txNumber::txNumber(txXSLTNumber::LevelType aLevel, nsAutoPtr<txPattern> aCount,
nsAutoPtr<txPattern> aFrom, nsAutoPtr<Expr> aValue,
nsAutoPtr<Expr> aFormat, nsAutoPtr<Expr> aGroupingSeparator,
nsAutoPtr<Expr> aGroupingSize)
: mLevel(aLevel), mCount(aCount), mFrom(aFrom), mValue(aValue),
mFormat(aFormat), mGroupingSeparator(aGroupingSeparator),
mGroupingSize(aGroupingSize)
txNumber::txNumber(txXSLTNumber::LevelType aLevel,
nsAutoPtr<txPattern>&& aCount, nsAutoPtr<txPattern>&& aFrom,
nsAutoPtr<Expr>&& aValue, nsAutoPtr<Expr>&& aFormat,
nsAutoPtr<Expr>&& aGroupingSeparator,
nsAutoPtr<Expr>&& aGroupingSize)
: mLevel(aLevel), mCount(Move(aCount)),
mFrom(Move(aFrom)),
mValue(Move(aValue)),
mFormat(Move(aFormat)),
mGroupingSeparator(Move(aGroupingSeparator)),
mGroupingSize(Move(aGroupingSize))
{
}
@ -572,8 +576,8 @@ txPopParams::execute(txExecutionState& aEs)
return NS_OK;
}
txProcessingInstruction::txProcessingInstruction(nsAutoPtr<Expr> aName)
: mName(aName)
txProcessingInstruction::txProcessingInstruction(nsAutoPtr<Expr>&& aName)
: mName(Move(aName))
{
}
@ -599,8 +603,8 @@ txProcessingInstruction::execute(txExecutionState& aEs)
return aEs.mResultHandler->processingInstruction(name, handler->mValue);
}
txPushNewContext::txPushNewContext(nsAutoPtr<Expr> aSelect)
: mSelect(aSelect), mBailTarget(nullptr)
txPushNewContext::txPushNewContext(nsAutoPtr<Expr>&& aSelect)
: mSelect(Move(aSelect)), mBailTarget(nullptr)
{
}
@ -660,19 +664,19 @@ txPushNewContext::execute(txExecutionState& aEs)
}
nsresult
txPushNewContext::addSort(nsAutoPtr<Expr> aSelectExpr,
nsAutoPtr<Expr> aLangExpr,
nsAutoPtr<Expr> aDataTypeExpr,
nsAutoPtr<Expr> aOrderExpr,
nsAutoPtr<Expr> aCaseOrderExpr)
txPushNewContext::addSort(nsAutoPtr<Expr>&& aSelectExpr,
nsAutoPtr<Expr>&& aLangExpr,
nsAutoPtr<Expr>&& aDataTypeExpr,
nsAutoPtr<Expr>&& aOrderExpr,
nsAutoPtr<Expr>&& aCaseOrderExpr)
{
if (SortKey *key = mSortKeys.AppendElement()) {
// workaround for not triggering the Copy Constructor
key->mSelectExpr = aSelectExpr;
key->mLangExpr = aLangExpr;
key->mDataTypeExpr = aDataTypeExpr;
key->mOrderExpr = aOrderExpr;
key->mCaseOrderExpr = aCaseOrderExpr;
key->mSelectExpr = Move(aSelectExpr);
key->mLangExpr = Move(aLangExpr);
key->mDataTypeExpr = Move(aDataTypeExpr);
key->mOrderExpr = Move(aOrderExpr);
key->mCaseOrderExpr = Move(aCaseOrderExpr);
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
@ -748,8 +752,8 @@ txReturn::execute(txExecutionState& aEs)
return NS_OK;
}
txSetParam::txSetParam(const txExpandedName& aName, nsAutoPtr<Expr> aValue)
: mName(aName), mValue(aValue)
txSetParam::txSetParam(const txExpandedName& aName, nsAutoPtr<Expr>&& aValue)
: mName(aName), mValue(Move(aValue))
{
}
@ -782,8 +786,8 @@ txSetParam::execute(txExecutionState& aEs)
}
txSetVariable::txSetVariable(const txExpandedName& aName,
nsAutoPtr<Expr> aValue)
: mName(aName), mValue(aValue)
nsAutoPtr<Expr>&& aValue)
: mName(aName), mValue(Move(aValue))
{
}
@ -806,11 +810,11 @@ txSetVariable::execute(txExecutionState& aEs)
return aEs.bindVariable(mName, exprRes);
}
txStartElement::txStartElement(nsAutoPtr<Expr> aName,
nsAutoPtr<Expr> aNamespace,
txStartElement::txStartElement(nsAutoPtr<Expr>&& aName,
nsAutoPtr<Expr>&& aNamespace,
txNamespaceMap* aMappings)
: mName(aName),
mNamespace(aNamespace),
: mName(Move(aName)),
mNamespace(Move(aNamespace)),
mMappings(aMappings)
{
}
@ -916,8 +920,8 @@ txText::execute(txExecutionState& aEs)
return aEs.mResultHandler->characters(mStr, mDOE);
}
txValueOf::txValueOf(nsAutoPtr<Expr> aExpr, bool aDOE)
: mExpr(aExpr),
txValueOf::txValueOf(nsAutoPtr<Expr>&& aExpr, bool aDOE)
: mExpr(Move(aExpr)),
mDOE(aDOE)
{
}

View File

@ -71,7 +71,7 @@ public:
class txAttribute : public txInstruction
{
public:
txAttribute(nsAutoPtr<Expr> aName, nsAutoPtr<Expr> aNamespace,
txAttribute(nsAutoPtr<Expr>&& aName, nsAutoPtr<Expr>&& aNamespace,
txNamespaceMap* aMappings);
TX_DECL_TXINSTRUCTION
@ -105,7 +105,7 @@ public:
class txConditionalGoto : public txInstruction
{
public:
txConditionalGoto(nsAutoPtr<Expr> aCondition, txInstruction* aTarget);
txConditionalGoto(nsAutoPtr<Expr>&& aCondition, txInstruction* aTarget);
TX_DECL_TXINSTRUCTION
@ -138,7 +138,7 @@ public:
class txCopyOf : public txCopyBase
{
public:
txCopyOf(nsAutoPtr<Expr> aSelect);
txCopyOf(nsAutoPtr<Expr>&& aSelect);
TX_DECL_TXINSTRUCTION
@ -191,7 +191,7 @@ class txLREAttribute : public txInstruction
{
public:
txLREAttribute(int32_t aNamespaceID, nsIAtom* aLocalName,
nsIAtom* aPrefix, nsAutoPtr<Expr> aValue);
nsIAtom* aPrefix, nsAutoPtr<Expr>&& aValue);
TX_DECL_TXINSTRUCTION
@ -215,10 +215,10 @@ public:
class txNumber : public txInstruction
{
public:
txNumber(txXSLTNumber::LevelType aLevel, nsAutoPtr<txPattern> aCount,
nsAutoPtr<txPattern> aFrom, nsAutoPtr<Expr> aValue,
nsAutoPtr<Expr> aFormat, nsAutoPtr<Expr> aGroupingSeparator,
nsAutoPtr<Expr> aGroupingSize);
txNumber(txXSLTNumber::LevelType aLevel, nsAutoPtr<txPattern>&& aCount,
nsAutoPtr<txPattern>&& aFrom, nsAutoPtr<Expr>&& aValue,
nsAutoPtr<Expr>&& aFormat, nsAutoPtr<Expr>&& aGroupingSeparator,
nsAutoPtr<Expr>&& aGroupingSize);
TX_DECL_TXINSTRUCTION
@ -240,7 +240,7 @@ public:
class txProcessingInstruction : public txInstruction
{
public:
txProcessingInstruction(nsAutoPtr<Expr> aName);
txProcessingInstruction(nsAutoPtr<Expr>&& aName);
TX_DECL_TXINSTRUCTION
@ -250,15 +250,17 @@ public:
class txPushNewContext : public txInstruction
{
public:
txPushNewContext(nsAutoPtr<Expr> aSelect);
txPushNewContext(nsAutoPtr<Expr>&& aSelect);
~txPushNewContext();
TX_DECL_TXINSTRUCTION
nsresult addSort(nsAutoPtr<Expr> aSelectExpr, nsAutoPtr<Expr> aLangExpr,
nsAutoPtr<Expr> aDataTypeExpr, nsAutoPtr<Expr> aOrderExpr,
nsAutoPtr<Expr> aCaseOrderExpr);
nsresult addSort(nsAutoPtr<Expr>&& aSelectExpr,
nsAutoPtr<Expr>&& aLangExpr,
nsAutoPtr<Expr>&& aDataTypeExpr,
nsAutoPtr<Expr>&& aOrderExpr,
nsAutoPtr<Expr>&& aCaseOrderExpr);
struct SortKey {
nsAutoPtr<Expr> mSelectExpr;
@ -320,7 +322,7 @@ public:
class txSetParam : public txInstruction
{
public:
txSetParam(const txExpandedName& aName, nsAutoPtr<Expr> aValue);
txSetParam(const txExpandedName& aName, nsAutoPtr<Expr>&& aValue);
TX_DECL_TXINSTRUCTION
@ -331,7 +333,7 @@ public:
class txSetVariable : public txInstruction
{
public:
txSetVariable(const txExpandedName& aName, nsAutoPtr<Expr> aValue);
txSetVariable(const txExpandedName& aName, nsAutoPtr<Expr>&& aValue);
TX_DECL_TXINSTRUCTION
@ -342,7 +344,7 @@ public:
class txStartElement : public txInstruction
{
public:
txStartElement(nsAutoPtr<Expr> aName, nsAutoPtr<Expr> aNamespace,
txStartElement(nsAutoPtr<Expr>&& aName, nsAutoPtr<Expr>&& aNamespace,
txNamespaceMap* aMappings);
TX_DECL_TXINSTRUCTION
@ -380,7 +382,7 @@ public:
class txValueOf : public txInstruction
{
public:
txValueOf(nsAutoPtr<Expr> aExpr, bool aDOE);
txValueOf(nsAutoPtr<Expr>&& aExpr, bool aDOE);
TX_DECL_TXINSTRUCTION

View File

@ -120,7 +120,7 @@ public:
* @param aUse use-expression
* @return false if an error occurred, true otherwise
*/
bool addKey(nsAutoPtr<txPattern> aMatch, nsAutoPtr<Expr> aUse);
bool addKey(nsAutoPtr<txPattern>&& aMatch, nsAutoPtr<Expr>&& aUse);
/**
* Indexes a subtree and adds it to the hash of key values

View File

@ -12,6 +12,7 @@
#include "txXSLTPatterns.h"
#include "txNamespaceMap.h"
#include "mozilla/HashFunctions.h"
#include "mozilla/Move.h"
using namespace mozilla;
@ -251,7 +252,7 @@ txKeyHash::init()
* @param aUse use-expression
* @return false if an error occurred, true otherwise
*/
bool txXSLKey::addKey(nsAutoPtr<txPattern> aMatch, nsAutoPtr<Expr> aUse)
bool txXSLKey::addKey(nsAutoPtr<txPattern>&& aMatch, nsAutoPtr<Expr>&& aUse)
{
if (!aMatch || !aUse)
return false;
@ -260,8 +261,8 @@ bool txXSLKey::addKey(nsAutoPtr<txPattern> aMatch, nsAutoPtr<Expr> aUse)
if (!key)
return false;
key->matchPattern = aMatch;
key->useExpr = aUse;
key->matchPattern = Move(aMatch);
key->useExpr = Move(aUse);
return true;
}

View File

@ -4,10 +4,13 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "txRtfHandler.h"
#include "mozilla/Move.h"
txResultTreeFragment::txResultTreeFragment(nsAutoPtr<txResultBuffer>& aBuffer)
using mozilla::Move;
txResultTreeFragment::txResultTreeFragment(nsAutoPtr<txResultBuffer>&& aBuffer)
: txAExprResult(nullptr),
mBuffer(aBuffer)
mBuffer(Move(aBuffer))
{
}
@ -58,7 +61,7 @@ nsresult txResultTreeFragment::flushToHandler(txAXMLEventHandler* aHandler)
nsresult
txRtfHandler::getAsRTF(txAExprResult** aResult)
{
*aResult = new txResultTreeFragment(mBuffer);
*aResult = new txResultTreeFragment(Move(mBuffer));
NS_ENSURE_TRUE(*aResult, NS_ERROR_OUT_OF_MEMORY);
NS_ADDREF(*aResult);

View File

@ -14,7 +14,7 @@
class txResultTreeFragment : public txAExprResult
{
public:
txResultTreeFragment(nsAutoPtr<txResultBuffer>& aBuffer);
txResultTreeFragment(nsAutoPtr<txResultBuffer>&& aBuffer);
TX_DECL_EXPRRESULT

View File

@ -4,6 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/FloatingPoint.h"
#include "mozilla/Move.h"
#include "txStylesheet.h"
#include "txExpr.h"
@ -15,6 +16,8 @@
#include "txKey.h"
#include "txXPathTreeWalker.h"
using mozilla::Move;
txStylesheet::txStylesheet()
: mRootFrame(nullptr)
{
@ -39,7 +42,7 @@ txStylesheet::init()
nt.forget();
txPushNewContext* pushContext = new txPushNewContext(nodeExpr);
txPushNewContext* pushContext = new txPushNewContext(Move(nodeExpr));
mContainerTemplate->mNext = pushContext;
NS_ENSURE_TRUE(pushContext, NS_ERROR_OUT_OF_MEMORY);
@ -68,7 +71,7 @@ txStylesheet::init()
nt.forget();
mCharactersTemplate = new txValueOf(nodeExpr, false);
mCharactersTemplate = new txValueOf(Move(nodeExpr), false);
NS_ENSURE_TRUE(mCharactersTemplate, NS_ERROR_OUT_OF_MEMORY);
mCharactersTemplate->mNext = new txReturn();
@ -400,10 +403,10 @@ txStylesheet::addTemplate(txTemplateItem* aTemplate,
// Add the simple patterns to the list of matchable templates, according
// to default priority
nsAutoPtr<txPattern> simple = aTemplate->mMatch;
nsAutoPtr<txPattern> simple = Move(aTemplate->mMatch);
nsAutoPtr<txPattern> unionPattern;
if (simple->getType() == txPattern::UNION_PATTERN) {
unionPattern = simple;
unionPattern = Move(simple);
simple = unionPattern->getSubPatternAt(0);
unionPattern->setSubPatternAt(0, nullptr);
}
@ -428,7 +431,7 @@ txStylesheet::addTemplate(txTemplateItem* aTemplate,
NS_ENSURE_TRUE(nt, NS_ERROR_OUT_OF_MEMORY);
nt->mFirstInstruction = instr;
nt->mMatch = simple;
nt->mMatch = Move(simple);
nt->mPriority = priority;
if (unionPattern) {
@ -539,7 +542,8 @@ txStylesheet::addGlobalVariable(txVariableItem* aVariable)
return NS_OK;
}
nsAutoPtr<GlobalVariable> var(
new GlobalVariable(aVariable->mValue, aVariable->mFirstInstruction,
new GlobalVariable(Move(aVariable->mValue),
Move(aVariable->mFirstInstruction),
aVariable->mIsParam));
NS_ENSURE_TRUE(var, NS_ERROR_OUT_OF_MEMORY);
@ -569,7 +573,7 @@ txStylesheet::addKey(const txExpandedName& aName,
return rv;
}
}
if (!xslKey->addKey(aMatch, aUse)) {
if (!xslKey->addKey(Move(aMatch), Move(aUse))) {
return NS_ERROR_OUT_OF_MEMORY;
}
return NS_OK;
@ -577,7 +581,7 @@ txStylesheet::addKey(const txExpandedName& aName,
nsresult
txStylesheet::addDecimalFormat(const txExpandedName& aName,
nsAutoPtr<txDecimalFormat> aFormat)
nsAutoPtr<txDecimalFormat>&& aFormat)
{
txDecimalFormat* existing = mDecimalFormats.get(aName);
if (existing) {
@ -603,9 +607,11 @@ txStylesheet::ImportFrame::~ImportFrame()
}
}
txStylesheet::GlobalVariable::GlobalVariable(nsAutoPtr<Expr> aExpr,
nsAutoPtr<txInstruction> aFirstInstruction,
txStylesheet::GlobalVariable::GlobalVariable(nsAutoPtr<Expr>&& aExpr,
nsAutoPtr<txInstruction>&& aInstr,
bool aIsParam)
: mExpr(aExpr), mFirstInstruction(aFirstInstruction), mIsParam(aIsParam)
: mExpr(Move(aExpr)),
mFirstInstruction(Move(aInstr)),
mIsParam(aIsParam)
{
}

View File

@ -65,7 +65,7 @@ public:
* Add a decimal-format to the stylesheet
*/
nsresult addDecimalFormat(const txExpandedName& aName,
nsAutoPtr<txDecimalFormat> aFormat);
nsAutoPtr<txDecimalFormat>&& aFormat);
struct MatchableTemplate {
txInstruction* mFirstInstruction;
@ -96,8 +96,8 @@ public:
class GlobalVariable : public txObject {
public:
GlobalVariable(nsAutoPtr<Expr> aExpr,
nsAutoPtr<txInstruction> aFirstInstruction,
GlobalVariable(nsAutoPtr<Expr>&& aExpr,
nsAutoPtr<txInstruction>&& aFirstInstruction,
bool aIsParam);
nsAutoPtr<Expr> mExpr;

View File

@ -5,6 +5,7 @@
#include "mozilla/ArrayUtils.h"
#include "mozilla/FloatingPoint.h"
#include "mozilla/Move.h"
#include "txStylesheetCompiler.h"
#include "txStylesheetCompileHandlers.h"
@ -114,7 +115,7 @@ parseUseAttrSets(txStylesheetAttr* aAttributes,
nsAutoPtr<txInstruction> instr(new txInsertAttrSet(name));
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
rv = aState.addInstruction(instr);
rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
}
return NS_OK;
@ -525,7 +526,7 @@ txFnStartLREStylesheet(int32_t aNamespaceID,
nsAutoPtr<txPattern> match(new txRootPattern());
NS_ENSURE_TRUE(match, NS_ERROR_OUT_OF_MEMORY);
nsAutoPtr<txTemplateItem> templ(new txTemplateItem(match, nullExpr,
nsAutoPtr<txTemplateItem> templ(new txTemplateItem(Move(match), nullExpr,
nullExpr, prio));
NS_ENSURE_TRUE(templ, NS_ERROR_OUT_OF_MEMORY);
@ -553,7 +554,7 @@ txFnEndLREStylesheet(txStylesheetCompilerState& aState)
nsAutoPtr<txInstruction> instr(new txReturn());
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
rv = aState.addInstruction(instr);
rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
aState.closeInstructionContainer();
@ -659,7 +660,7 @@ txFnEndAttributeSet(txStylesheetCompilerState& aState)
nsAutoPtr<txInstruction> instr(new txReturn());
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = aState.addInstruction(instr);
nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
aState.closeInstructionContainer();
@ -735,7 +736,7 @@ txFnStartDecimalFormat(int32_t aNamespaceID,
false, aState, format->mPatternSeparator);
NS_ENSURE_SUCCESS(rv, rv);
rv = aState.mStylesheet->addDecimalFormat(name, format);
rv = aState.mStylesheet->addDecimalFormat(name, Move(format));
NS_ENSURE_SUCCESS(rv, rv);
return aState.pushHandlerTable(gTxIgnoreHandler);
@ -847,7 +848,7 @@ txFnStartKey(int32_t aNamespaceID,
aState, use);
NS_ENSURE_SUCCESS(rv, rv);
rv = aState.mStylesheet->addKey(name, match, use);
rv = aState.mStylesheet->addKey(name, Move(match), Move(use));
NS_ENSURE_SUCCESS(rv, rv);
return aState.pushHandlerTable(gTxIgnoreHandler);
@ -1123,7 +1124,8 @@ txFnStartTemplate(int32_t aNamespaceID,
name.isNull(), aState, match);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txTemplateItem> templ(new txTemplateItem(match, name, mode, prio));
nsAutoPtr<txTemplateItem> templ(new txTemplateItem(Move(match), name, mode,
prio));
NS_ENSURE_TRUE(templ, NS_ERROR_OUT_OF_MEMORY);
aState.openInstructionContainer(templ);
@ -1143,7 +1145,7 @@ txFnEndTemplate(txStylesheetCompilerState& aState)
nsAutoPtr<txInstruction> instr(new txReturn());
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = aState.addInstruction(instr);
nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
aState.closeInstructionContainer();
@ -1172,7 +1174,8 @@ txFnStartTopVariable(int32_t aNamespaceID,
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txVariableItem> var(
new txVariableItem(name, select, aLocalName == nsGkAtoms::param));
new txVariableItem(name, Move(select),
aLocalName == nsGkAtoms::param));
NS_ENSURE_TRUE(var, NS_ERROR_OUT_OF_MEMORY);
aState.openInstructionContainer(var);
@ -1217,7 +1220,7 @@ txFnEndTopVariable(txStylesheetCompilerState& aState)
nsAutoPtr<txInstruction> instr(new txReturn());
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = aState.addInstruction(instr);
nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
}
@ -1276,7 +1279,7 @@ txFnStartLRE(int32_t aNamespaceID,
aLocalName, aPrefix));
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
rv = aState.addInstruction(instr);
rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
rv = parseExcludeResultPrefixes(aAttributes, aAttrCount, kNameSpaceID_XSLT);
@ -1304,10 +1307,10 @@ txFnStartLRE(int32_t aNamespaceID,
NS_ENSURE_SUCCESS(rv, rv);
instr = new txLREAttribute(attr->mNamespaceID, attr->mLocalName,
attr->mPrefix, avt);
attr->mPrefix, Move(avt));
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
rv = aState.addInstruction(instr);
rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
}
@ -1320,7 +1323,7 @@ txFnEndLRE(txStylesheetCompilerState& aState)
nsAutoPtr<txInstruction> instr(new txEndElement);
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = aState.addInstruction(instr);
nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@ -1339,7 +1342,7 @@ txFnText(const nsAString& aStr, txStylesheetCompilerState& aState)
nsAutoPtr<txInstruction> instr(new txText(aStr, false));
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = aState.addInstruction(instr);
nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@ -1364,13 +1367,13 @@ txFnStartApplyImports(int32_t aNamespaceID,
nsAutoPtr<txInstruction> instr(new txApplyImportsStart);
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
rv = aState.addInstruction(instr);
rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
instr = new txApplyImportsEnd;
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
rv = aState.addInstruction(instr);
rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return aState.pushHandlerTable(gTxIgnoreHandler);
@ -1407,7 +1410,7 @@ txFnStartApplyTemplates(int32_t aNamespaceID,
nsAutoPtr<txInstruction> instr(new txPushParams);
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
rv = aState.addInstruction(instr);
rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
txExpandedName mode;
@ -1439,7 +1442,7 @@ txFnStartApplyTemplates(int32_t aNamespaceID,
nt.forget();
}
nsAutoPtr<txPushNewContext> pushcontext(new txPushNewContext(select));
nsAutoPtr<txPushNewContext> pushcontext( new txPushNewContext(Move(select)));
NS_ENSURE_TRUE(pushcontext, NS_ERROR_OUT_OF_MEMORY);
rv = aState.pushSorter(pushcontext);
@ -1461,7 +1464,7 @@ txFnEndApplyTemplates(txStylesheetCompilerState& aState)
txPushNewContext* pushcontext =
static_cast<txPushNewContext*>(aState.popObject());
nsAutoPtr<txInstruction> instr(pushcontext); // txPushNewContext
nsresult rv = aState.addInstruction(instr);
nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
aState.popSorter();
@ -1470,18 +1473,18 @@ txFnEndApplyTemplates(txStylesheetCompilerState& aState)
nsAutoPtr<txLoopNodeSet> loop(new txLoopNodeSet(instr));
NS_ENSURE_TRUE(loop, NS_ERROR_OUT_OF_MEMORY);
rv = aState.addInstruction(instr);
rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
instr = loop.forget();
rv = aState.addInstruction(instr);
rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
instr = new txPopParams;
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
pushcontext->mBailTarget = instr;
rv = aState.addInstruction(instr);
rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@ -1507,7 +1510,7 @@ txFnStartAttribute(int32_t aNamespaceID,
nsAutoPtr<txInstruction> instr(new txPushStringHandler(true));
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
rv = aState.addInstruction(instr);
rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<Expr> name;
@ -1520,7 +1523,8 @@ txFnStartAttribute(int32_t aNamespaceID,
aState, nspace);
NS_ENSURE_SUCCESS(rv, rv);
instr = new txAttribute(name, nspace, aState.mElementContext->mMappings);
instr = new txAttribute(Move(name), Move(nspace),
aState.mElementContext->mMappings);
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
rv = aState.pushObject(instr);
@ -1539,7 +1543,7 @@ txFnEndAttribute(txStylesheetCompilerState& aState)
aState.popHandlerTable();
nsAutoPtr<txInstruction> instr(static_cast<txInstruction*>
(aState.popObject()));
nsresult rv = aState.addInstruction(instr);
nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@ -1566,7 +1570,7 @@ txFnStartCallTemplate(int32_t aNamespaceID,
nsAutoPtr<txInstruction> instr(new txPushParams);
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
rv = aState.addInstruction(instr);
rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
txExpandedName name;
@ -1592,13 +1596,13 @@ txFnEndCallTemplate(txStylesheetCompilerState& aState)
// txCallTemplate
nsAutoPtr<txInstruction> instr(static_cast<txInstruction*>(aState.popObject()));
nsresult rv = aState.addInstruction(instr);
nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
instr = new txPopParams;
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
rv = aState.addInstruction(instr);
rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@ -1667,7 +1671,7 @@ txFnStartComment(int32_t aNamespaceID,
nsAutoPtr<txInstruction> instr(new txPushStringHandler(true));
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = aState.addInstruction(instr);
nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@ -1679,7 +1683,7 @@ txFnEndComment(txStylesheetCompilerState& aState)
nsAutoPtr<txInstruction> instr(new txComment);
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = aState.addInstruction(instr);
nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@ -1709,7 +1713,7 @@ txFnStartCopy(int32_t aNamespaceID,
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txInstruction> instr(copy.forget());
rv = aState.addInstruction(instr);
rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
rv = parseUseAttrSets(aAttributes, aAttrCount, false, aState);
@ -1724,7 +1728,7 @@ txFnEndCopy(txStylesheetCompilerState& aState)
nsAutoPtr<txInstruction> instr(new txEndElement);
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = aState.addInstruction(instr);
nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
txCopy* copy = static_cast<txCopy*>(aState.popPtr(aState.eCopy));
@ -1754,10 +1758,10 @@ txFnStartCopyOf(int32_t aNamespaceID,
aState, select);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txInstruction> instr(new txCopyOf(select));
nsAutoPtr<txInstruction> instr(new txCopyOf(Move(select)));
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
rv = aState.addInstruction(instr);
rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return aState.pushHandlerTable(gTxIgnoreHandler);
@ -1799,10 +1803,11 @@ txFnStartElement(int32_t aNamespaceID,
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txInstruction> instr(
new txStartElement(name, nspace, aState.mElementContext->mMappings));
new txStartElement(Move(name), Move(nspace),
aState.mElementContext->mMappings));
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
rv = aState.addInstruction(instr);
rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
rv = parseUseAttrSets(aAttributes, aAttrCount, false, aState);
@ -1817,7 +1822,7 @@ txFnEndElement(txStylesheetCompilerState& aState)
nsAutoPtr<txInstruction> instr(new txEndElement);
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = aState.addInstruction(instr);
nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@ -1875,7 +1880,7 @@ txFnStartForEach(int32_t aNamespaceID,
aState, select);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txPushNewContext> pushcontext(new txPushNewContext(select));
nsAutoPtr<txPushNewContext> pushcontext(new txPushNewContext(Move(select)));
NS_ENSURE_TRUE(pushcontext, NS_ERROR_OUT_OF_MEMORY);
rv = aState.pushPtr(pushcontext, aState.ePushNewContext);
@ -1885,7 +1890,7 @@ txFnStartForEach(int32_t aNamespaceID,
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txInstruction> instr(pushcontext.forget());
rv = aState.addInstruction(instr);
rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
instr = new txPushNullTemplateRule;
@ -1894,7 +1899,7 @@ txFnStartForEach(int32_t aNamespaceID,
rv = aState.pushPtr(instr, aState.ePushNullTemplateRule);
NS_ENSURE_SUCCESS(rv, rv);
rv = aState.addInstruction(instr);
rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return aState.pushHandlerTable(gTxForEachHandler);
@ -1910,7 +1915,7 @@ txFnEndForEach(txStylesheetCompilerState& aState)
static_cast<txInstruction*>(aState.popPtr(aState.ePushNullTemplateRule));
nsAutoPtr<txInstruction> instr(new txLoopNodeSet(pnullrule));
nsresult rv = aState.addInstruction(instr);
nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
aState.popSorter();
@ -1967,14 +1972,15 @@ txFnStartIf(int32_t aNamespaceID,
aState, test);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txConditionalGoto> condGoto(new txConditionalGoto(test, nullptr));
nsAutoPtr<txConditionalGoto> condGoto(new txConditionalGoto(Move(test),
nullptr));
NS_ENSURE_TRUE(condGoto, NS_ERROR_OUT_OF_MEMORY);
rv = aState.pushPtr(condGoto, aState.eConditionalGoto);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txInstruction> instr(condGoto.forget());
rv = aState.addInstruction(instr);
rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@ -2006,7 +2012,7 @@ txFnStartMessage(int32_t aNamespaceID,
nsAutoPtr<txInstruction> instr(new txPushStringHandler(false));
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = aState.addInstruction(instr);
nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
txThreeState term;
@ -2029,7 +2035,7 @@ static nsresult
txFnEndMessage(txStylesheetCompilerState& aState)
{
nsAutoPtr<txInstruction> instr(static_cast<txInstruction*>(aState.popObject()));
nsresult rv = aState.addInstruction(instr);
nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@ -2106,12 +2112,13 @@ txFnStartNumber(int32_t aNamespaceID,
false, aState, groupingSize);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txInstruction> instr(new txNumber(level, count, from, value,
format,groupingSeparator,
groupingSize));
nsAutoPtr<txInstruction> instr(new txNumber(level, Move(count), Move(from),
Move(value), Move(format),
Move(groupingSeparator),
Move(groupingSize)));
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
rv = aState.addInstruction(instr);
rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return aState.pushHandlerTable(gTxIgnoreHandler);
@ -2181,7 +2188,7 @@ txFnStartParam(int32_t aNamespaceID,
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txInstruction> instr(checkParam.forget());
rv = aState.addInstruction(instr);
rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<Expr> select;
@ -2189,7 +2196,7 @@ txFnStartParam(int32_t aNamespaceID,
aState, select);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txSetVariable> var(new txSetVariable(name, select));
nsAutoPtr<txSetVariable> var(new txSetVariable(name, Move(select)));
NS_ENSURE_TRUE(var, NS_ERROR_OUT_OF_MEMORY);
if (var->mValue) {
@ -2230,7 +2237,7 @@ txFnEndParam(txStylesheetCompilerState& aState)
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txInstruction> instr(var.forget());
rv = aState.addInstruction(instr);
rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
txCheckParam* checkParam =
@ -2258,7 +2265,7 @@ txFnStartPI(int32_t aNamespaceID,
nsAutoPtr<txInstruction> instr(new txPushStringHandler(true));
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = aState.addInstruction(instr);
nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<Expr> name;
@ -2266,7 +2273,7 @@ txFnStartPI(int32_t aNamespaceID,
aState, name);
NS_ENSURE_SUCCESS(rv, rv);
instr = new txProcessingInstruction(name);
instr = new txProcessingInstruction(Move(name));
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
rv = aState.pushObject(instr);
@ -2282,7 +2289,7 @@ txFnEndPI(txStylesheetCompilerState& aState)
{
nsAutoPtr<txInstruction> instr(static_cast<txInstruction*>
(aState.popObject()));
nsresult rv = aState.addInstruction(instr);
nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@ -2339,7 +2346,8 @@ txFnStartSort(int32_t aNamespaceID,
aState, caseOrder);
NS_ENSURE_SUCCESS(rv, rv);
rv = aState.mSorter->addSort(select, lang, dataType, order, caseOrder);
rv = aState.mSorter->addSort(Move(select), Move(lang), Move(dataType),
Move(order), Move(caseOrder));
NS_ENSURE_SUCCESS(rv, rv);
return aState.pushHandlerTable(gTxIgnoreHandler);
@ -2394,7 +2402,7 @@ txFnTextText(const nsAString& aStr, txStylesheetCompilerState& aState)
nsAutoPtr<txInstruction> instr(new txText(aStr, aState.mDOE));
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = aState.addInstruction(instr);
nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@ -2426,10 +2434,10 @@ txFnStartValueOf(int32_t aNamespaceID,
aState, select);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txInstruction> instr(new txValueOf(select, doe == eTrue));
nsAutoPtr<txInstruction> instr(new txValueOf(Move(select), doe == eTrue));
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
rv = aState.addInstruction(instr);
rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return aState.pushHandlerTable(gTxIgnoreHandler);
@ -2469,7 +2477,7 @@ txFnStartVariable(int32_t aNamespaceID,
aState, select);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txSetVariable> var(new txSetVariable(name, select));
nsAutoPtr<txSetVariable> var(new txSetVariable(name, Move(select)));
NS_ENSURE_TRUE(var, NS_ERROR_OUT_OF_MEMORY);
if (var->mValue) {
@ -2511,7 +2519,7 @@ txFnEndVariable(txStylesheetCompilerState& aState)
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txInstruction> instr(var.forget());
rv = aState.addInstruction(instr);
rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@ -2528,7 +2536,7 @@ txFnStartElementStartRTF(int32_t aNamespaceID,
nsAutoPtr<txInstruction> instr(new txPushRTFHandler);
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = aState.addInstruction(instr);
nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
aState.mHandlerTable = gTxTemplateHandler;
@ -2544,7 +2552,7 @@ txFnTextStartRTF(const nsAString& aStr, txStylesheetCompilerState& aState)
nsAutoPtr<txInstruction> instr(new txPushRTFHandler);
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = aState.addInstruction(instr);
nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
aState.mHandlerTable = gTxTemplateHandler;
@ -2572,14 +2580,15 @@ txFnStartWhen(int32_t aNamespaceID,
aState, test);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txConditionalGoto> condGoto(new txConditionalGoto(test, nullptr));
nsAutoPtr<txConditionalGoto> condGoto(new txConditionalGoto(Move(test),
nullptr));
NS_ENSURE_TRUE(condGoto, NS_ERROR_OUT_OF_MEMORY);
rv = aState.pushPtr(condGoto, aState.eConditionalGoto);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txInstruction> instr(condGoto.forget());
rv = aState.addInstruction(instr);
rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return aState.pushHandlerTable(gTxTemplateHandler);
@ -2596,7 +2605,7 @@ txFnEndWhen(txStylesheetCompilerState& aState)
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txInstruction> instr(gotoinstr.forget());
rv = aState.addInstruction(instr);
rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
txConditionalGoto* condGoto =
@ -2634,7 +2643,7 @@ txFnStartWithParam(int32_t aNamespaceID,
aState, select);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txSetParam> var(new txSetParam(name, select));
nsAutoPtr<txSetParam> var(new txSetParam(name, Move(select)));
NS_ENSURE_TRUE(var, NS_ERROR_OUT_OF_MEMORY);
if (var->mValue) {
@ -2671,7 +2680,7 @@ txFnEndWithParam(txStylesheetCompilerState& aState)
}
nsAutoPtr<txInstruction> instr(var.forget());
nsresult rv = aState.addInstruction(instr);
nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@ -2713,7 +2722,7 @@ txFnEndUnknownInstruction(txStylesheetCompilerState& aState)
nsAutoPtr<txInstruction> instr(new txErrorInstruction());
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = aState.addInstruction(instr);
nsresult rv = aState.addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
}

View File

@ -4,6 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/ArrayUtils.h"
#include "mozilla/Move.h"
#include "txStylesheetCompiler.h"
#include "txStylesheetCompileHandlers.h"
@ -336,7 +337,7 @@ txStylesheetCompiler::endElement()
nsAutoPtr<txInstruction> instr(new txRemoveVariable(var->mName));
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
rv = addInstruction(instr);
rv = addInstruction(Move(instr));
NS_ENSURE_SUCCESS(rv, rv);
mInScopeVariables.RemoveElementAt(i);
@ -484,7 +485,7 @@ txStylesheetCompiler::ensureNewElementContext()
NS_ENSURE_SUCCESS(rv, rv);
mElementContext.forget();
mElementContext = context;
mElementContext = Move(context);
return NS_OK;
}
@ -723,7 +724,7 @@ txStylesheetCompilerState::closeInstructionContainer()
}
nsresult
txStylesheetCompilerState::addInstruction(nsAutoPtr<txInstruction> aInstruction)
txStylesheetCompilerState::addInstruction(nsAutoPtr<txInstruction>&& aInstruction)
{
NS_PRECONDITION(mNextInstrPtr, "adding instruction outside container");

View File

@ -111,7 +111,7 @@ public:
nsresult addToplevelItem(txToplevelItem* aItem);
nsresult openInstructionContainer(txInstructionContainer* aContainer);
void closeInstructionContainer();
nsresult addInstruction(nsAutoPtr<txInstruction> aInstruction);
nsresult addInstruction(nsAutoPtr<txInstruction>&& aInstruction);
nsresult loadIncludedStylesheet(const nsAString& aURI);
nsresult loadImportedStylesheet(const nsAString& aURI,
txStylesheet::ImportFrame* aFrame);

View File

@ -4,10 +4,14 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "txToplevelItems.h"
#include "mozilla/Move.h"
#include "txStylesheet.h"
#include "txInstructions.h"
#include "txXSLTPatterns.h"
using mozilla::Move;
TX_IMPL_GETTYPE(txAttributeSetItem, txToplevelItem::attributeSet)
TX_IMPL_GETTYPE(txImportItem, txToplevelItem::import)
TX_IMPL_GETTYPE(txOutputItem, txToplevelItem::output)
@ -35,18 +39,20 @@ txStripSpaceItem::addStripSpaceTest(txStripSpaceTest* aStripSpaceTest)
TX_IMPL_GETTYPE(txTemplateItem, txToplevelItem::templ)
txTemplateItem::txTemplateItem(nsAutoPtr<txPattern> aMatch,
txTemplateItem::txTemplateItem(nsAutoPtr<txPattern>&& aMatch,
const txExpandedName& aName,
const txExpandedName& aMode, double aPrio)
: mMatch(aMatch), mName(aName), mMode(aMode), mPrio(aPrio)
: mMatch(Move(aMatch)), mName(aName),
mMode(aMode), mPrio(aPrio)
{
}
TX_IMPL_GETTYPE(txVariableItem, txToplevelItem::variable)
txVariableItem::txVariableItem(const txExpandedName& aName,
nsAutoPtr<Expr> aValue,
nsAutoPtr<Expr>&& aValue,
bool aIsParam)
: mName(aName), mValue(aValue), mIsParam(aIsParam)
: mName(aName), mValue(Move(aValue)),
mIsParam(aIsParam)
{
}

View File

@ -107,7 +107,7 @@ public:
class txTemplateItem : public txInstructionContainer
{
public:
txTemplateItem(nsAutoPtr<txPattern> aMatch, const txExpandedName& aName,
txTemplateItem(nsAutoPtr<txPattern>&& aMatch, const txExpandedName& aName,
const txExpandedName& aMode, double aPrio);
TX_DECL_TOPLEVELITEM
@ -122,7 +122,7 @@ public:
class txVariableItem : public txInstructionContainer
{
public:
txVariableItem(const txExpandedName& aName, nsAutoPtr<Expr> aValue,
txVariableItem(const txExpandedName& aName, nsAutoPtr<Expr>&& aValue,
bool aIsParam);
TX_DECL_TOPLEVELITEM

View File

@ -4,11 +4,15 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "txUnknownHandler.h"
#include "mozilla/Move.h"
#include "txExecutionState.h"
#include "txStringUtils.h"
#include "txStylesheet.h"
#include "nsGkAtoms.h"
using mozilla::Move;
txUnknownHandler::txUnknownHandler(txExecutionState* aEs)
: mEs(aEs),
mFlushed(false)
@ -192,6 +196,6 @@ nsresult txUnknownHandler::createHandlerAndFlush(bool aHTMLRoot,
// Let go of out buffer as soon as we're done flushing it, we're not going
// to need it anymore from this point on (all hooks get forwarded to
// mEs->mResultHandler.
nsAutoPtr<txResultBuffer> buffer(mBuffer);
nsAutoPtr<txResultBuffer> buffer(Move(mBuffer));
return buffer->flushToHandler(mEs->mResultHandler);
}

View File

@ -484,9 +484,6 @@ class MOZ_NONHEAP_CLASS Handle : public js::HandleBase<T>
bool operator!=(const T &other) const { return *ptr != other; }
bool operator==(const T &other) const { return *ptr == other; }
/* Change this handle to point to the same rooted location RHS does. */
void repoint(const Handle &rhs) { ptr = rhs.address(); }
private:
Handle() {}

View File

@ -31,7 +31,6 @@ C1Spewer::beginFunction(MIRGraph *graph, HandleScript script)
return;
this->graph = graph;
this->script.repoint(script);
fprintf(spewout_, "begin_compilation\n");
if (script) {

View File

@ -26,12 +26,11 @@ class LInstruction;
class C1Spewer
{
MIRGraph *graph;
HandleScript script;
FILE *spewout_;
public:
C1Spewer()
: graph(nullptr), script(NullPtr()), spewout_(nullptr)
: graph(nullptr), spewout_(nullptr)
{ }
bool init(const char *path);

View File

@ -151,7 +151,6 @@ IonSpewer::beginFunction(MIRGraph *graph, HandleScript function)
}
this->graph = graph;
this->function.repoint(function);
c1Spewer.beginFunction(graph, function);
jsonSpewer.beginFunction(function);

View File

@ -97,14 +97,13 @@ class IonSpewer
{
private:
MIRGraph *graph;
JS::HandleScript function;
C1Spewer c1Spewer;
JSONSpewer jsonSpewer;
bool inited_;
public:
IonSpewer()
: graph(nullptr), function(NullPtr()), inited_(false)
: graph(nullptr), inited_(false)
{ }
// File output is terminated safely upon destruction.

View File

@ -788,7 +788,24 @@ WorkerThread::handleIonWorkload()
JS_ASSERT(WorkerThreadState().canStartIonCompile());
JS_ASSERT(idle());
ionBuilder = WorkerThreadState().ionWorklist().popCopy();
// Find the ionBuilder with the script having the highest usecount.
GlobalWorkerThreadState::IonBuilderVector &ionWorklist = WorkerThreadState().ionWorklist();
size_t highest = 0;
for (size_t i = 1; i < ionWorklist.length(); i++) {
if (ionWorklist[i]->script()->getUseCount() >
ionWorklist[highest]->script()->getUseCount())
{
highest = i;
}
}
ionBuilder = ionWorklist[highest];
// Pop the top IonBuilder and move it to the original place of the
// IonBuilder we took to start compiling. If both are the same, only pop.
if (highest != ionWorklist.length() - 1)
ionWorklist[highest] = ionWorklist.popCopy();
else
ionWorklist.popBack();
TraceLogger *logger = TraceLoggerForCurrentThread();
AutoTraceLog logScript(logger, TraceLogCreateTextId(logger, ionBuilder->script()));

View File

@ -798,9 +798,11 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
reflowState.ComputedLogicalOffsets().ConvertTo(frameWM, stateWM);
}
// Apply start margins (as appropriate) to the frame computing the
// new starting x,y coordinates for the frame.
ApplyStartMargin(pfd, reflowState);
// Calculate whether the the frame should have a start margin and
// subtract the margin from the available width if necessary.
// The margin will be applied to the starting inline coordinates of
// the frame in CanPlaceFrame() after reflowing the frame.
AllowForStartMargin(pfd, reflowState);
}
// if isText(), no need to propagate NS_FRAME_IS_DIRTY from the parent,
// because reflow doesn't look at the dirty bits on the frame being reflowed.
@ -1055,15 +1057,14 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
}
void
nsLineLayout::ApplyStartMargin(PerFrameData* pfd,
nsHTMLReflowState& aReflowState)
nsLineLayout::AllowForStartMargin(PerFrameData* pfd,
nsHTMLReflowState& aReflowState)
{
NS_ASSERTION(!aReflowState.IsFloating(),
"How'd we get a floated inline frame? "
"The frame ctor should've dealt with this.");
WritingMode frameWM = pfd->mFrame->GetWritingMode();
WritingMode lineWM = mRootSpan->mWritingMode;
// Only apply start-margin on the first-in flow for inline frames,
// and make sure to not apply it to any inline other than the first
@ -1079,21 +1080,7 @@ nsLineLayout::ApplyStartMargin(PerFrameData* pfd,
// Zero this out so that when we compute the max-element-width of
// the frame we will properly avoid adding in the starting margin.
pfd->mMargin.IStart(frameWM) = 0;
}
if ((pfd->mFrame->LastInFlow()->GetNextContinuation() ||
pfd->mFrame->FrameIsNonLastInIBSplit())
&& !pfd->GetFlag(PFD_ISLETTERFRAME)) {
pfd->mMargin.IEnd(frameWM) = 0;
}
nscoord startMargin = pfd->mMargin.ConvertTo(lineWM, frameWM).IStart(lineWM);
if (startMargin) {
// In RTL mode, we will only apply the start margin to the frame bounds
// after we finish flowing the frame and know more accurately whether we
// want to skip the margins.
if (lineWM.IsBidiLTR() && frameWM.IsBidiLTR()) {
pfd->mBounds.IStart(lineWM) += startMargin;
}
} else {
NS_WARN_IF_FALSE(NS_UNCONSTRAINEDSIZE != aReflowState.AvailableWidth(),
"have unconstrained width; this should only result from "
"very large sizes, not attempts at intrinsic width "
@ -1103,7 +1090,7 @@ nsLineLayout::ApplyStartMargin(PerFrameData* pfd,
// in the reflow state), adjust available width to account for the
// start margin. The end margin will be accounted for when we
// finish flowing the frame.
aReflowState.AvailableWidth() -= startMargin;
aReflowState.AvailableWidth() -= pfd->mMargin.IStart(frameWM);
}
}
}
@ -1161,10 +1148,6 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd,
* For box-decoration-break:clone we apply the end margin on all
* continuations (that are not letter frames).
*/
if (pfd->mFrame->GetPrevContinuation() ||
pfd->mFrame->FrameIsNonFirstInIBSplit()) {
pfd->mMargin.IStart(frameWM) = 0;
}
if ((NS_FRAME_IS_NOT_COMPLETE(aStatus) ||
pfd->mFrame->LastInFlow()->GetNextContinuation() ||
pfd->mFrame->FrameIsNonLastInIBSplit()) &&
@ -1173,13 +1156,14 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd,
NS_STYLE_BOX_DECORATION_BREAK_SLICE) {
pfd->mMargin.IEnd(frameWM) = 0;
}
// Convert the frame's margins to the line's writing mode and apply
// the start margin to the frame bounds.
LogicalMargin usedMargins = pfd->mMargin.ConvertTo(lineWM, frameWM);
nscoord startMargin = usedMargins.IStart(lineWM);
nscoord endMargin = usedMargins.IEnd(lineWM);
if (!(lineWM.IsBidiLTR() && frameWM.IsBidiLTR())) {
pfd->mBounds.IStart(lineWM) += startMargin;
}
pfd->mBounds.IStart(lineWM) += startMargin;
PerSpanData* psd = mCurrentSpan;
if (psd->mNoWrap) {

View File

@ -528,8 +528,8 @@ protected:
void PushFrame(nsIFrame* aFrame);
void ApplyStartMargin(PerFrameData* pfd,
nsHTMLReflowState& aReflowState);
void AllowForStartMargin(PerFrameData* pfd,
nsHTMLReflowState& aReflowState);
bool CanPlaceFrame(PerFrameData* pfd,
bool aNotSafeToBreak,

View File

@ -8,6 +8,7 @@
#include "mozilla/ArrayUtils.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/Move.h"
#include "nsCSSParser.h"
#include "nsCSSProps.h"
@ -3575,7 +3576,7 @@ CSSParserImpl::ParsePageRule(RuleAppendFunc aAppendFunc, void* aData)
}
// Takes ownership of declaration.
nsRefPtr<nsCSSPageRule> rule = new nsCSSPageRule(declaration);
nsRefPtr<nsCSSPageRule> rule = new nsCSSPageRule(Move(declaration));
(*aAppendFunc)(rule, aData);
return true;
@ -3599,7 +3600,7 @@ CSSParserImpl::ParseKeyframeRule()
// Takes ownership of declaration, and steals contents of selectorList.
nsRefPtr<nsCSSKeyframeRule> rule =
new nsCSSKeyframeRule(selectorList, declaration);
new nsCSSKeyframeRule(selectorList, Move(declaration));
return rule.forget();
}

View File

@ -10,6 +10,7 @@
#define nsCSSRules_h_
#include "mozilla/Attributes.h"
#include "mozilla/Move.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/css/GroupRule.h"
@ -421,8 +422,8 @@ class nsCSSKeyframeRule MOZ_FINAL : public mozilla::css::Rule,
public:
// WARNING: Steals the contents of aKeys *and* aDeclaration
nsCSSKeyframeRule(InfallibleTArray<float>& aKeys,
nsAutoPtr<mozilla::css::Declaration> aDeclaration)
: mDeclaration(aDeclaration)
nsAutoPtr<mozilla::css::Declaration>&& aDeclaration)
: mDeclaration(mozilla::Move(aDeclaration))
{
mKeys.SwapElements(aKeys);
}
@ -548,8 +549,8 @@ class nsCSSPageRule MOZ_FINAL : public mozilla::css::Rule,
{
public:
// WARNING: Steals the contents of aDeclaration
nsCSSPageRule(nsAutoPtr<mozilla::css::Declaration> aDeclaration)
: mDeclaration(aDeclaration),
nsCSSPageRule(nsAutoPtr<mozilla::css::Declaration>&& aDeclaration)
: mDeclaration(mozilla::Move(aDeclaration)),
mImportantRule(nullptr)
{
}

View File

@ -2203,7 +2203,7 @@ nsHttpChannel::ProcessPartialContent()
if (NS_FAILED(rv)) return rv;
// make the cached response be the current response
mResponseHead = mCachedResponseHead;
mResponseHead = Move(mCachedResponseHead);
UpdateInhibitPersistentCachingFlag();
@ -2334,7 +2334,7 @@ nsHttpChannel::ProcessNotModified()
if (NS_FAILED(rv)) return rv;
// make the cached response be the current response
mResponseHead = mCachedResponseHead;
mResponseHead = Move(mCachedResponseHead);
UpdateInhibitPersistentCachingFlag();
@ -3536,7 +3536,7 @@ nsHttpChannel::ReadFromCache(bool alreadyMarkedValid)
"Using cached copy of: %s\n", this, mSpec.get()));
if (mCachedResponseHead)
mResponseHead = mCachedResponseHead;
mResponseHead = Move(mCachedResponseHead);
UpdateInhibitPersistentCachingFlag();
@ -5156,7 +5156,7 @@ nsHttpChannel::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult st
}
else if (contentLength != int64_t(-1) && contentLength != size) {
LOG((" concurrent cache entry write has been interrupted"));
mCachedResponseHead = mResponseHead;
mCachedResponseHead = Move(mResponseHead);
rv = MaybeSetupByteRangeRequest(size, contentLength);
if (NS_SUCCEEDED(rv) && mIsPartialRequest) {
// Prevent read from cache again

View File

@ -29,6 +29,17 @@ namespace mozilla {
* except CalculateResult might be skipped if NSS is shut down before it can
* be called; in that case ReleaseNSSResources will be called and then
* CallCallback will be called with an error code.
*
* That sequence of events is what happens if you call Dispatch. If for
* some reason, you decide not to run the task (e.g., due to an error in the
* constructor), you may call Skip, in which case the task is cleaned up and
* not run. In that case, only ReleaseNSSResources is called. (So a
* subclass must be prepared for ReleaseNSSResources to be run without
* CalculateResult having been called first.)
*
* Once a CryptoTask is created, the calling code must call either
* Dispatch or Skip.
*
*/
class CryptoTask : public nsRunnable,
public nsNSSShutDownObject
@ -48,6 +59,11 @@ public:
return rv;
}
void Skip()
{
virtualDestroyNSSReference();
}
protected:
CryptoTask()
: mRv(NS_ERROR_NOT_INITIALIZED),

View File

@ -6,6 +6,7 @@ const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.import("resource://gre/modules/osfile.jsm");
Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://gre/modules/Promise.jsm");
Cu.import("resource://gre/modules/WebappOSUtils.jsm");
const LINUX = navigator.platform.startsWith("Linux");
const MAC = navigator.platform.startsWith("Mac");
@ -78,6 +79,214 @@ function setDryRunPref() {
});
}
function TestAppInfo(aApp) {
this.appProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
this.isPackaged = !!aApp.updateManifest;
if (LINUX) {
this.installPath = OS.Path.join(OS.Constants.Path.homeDir,
"." + WebappOSUtils.getUniqueName(aApp));
this.exePath = OS.Path.join(this.installPath, "webapprt-stub");
let xdg_data_home = Cc["@mozilla.org/process/environment;1"].
getService(Ci.nsIEnvironment).
get("XDG_DATA_HOME");
if (!xdg_data_home) {
xdg_data_home = OS.Path.join(OS.Constants.Path.homeDir, ".local", "share");
}
let desktopINI = OS.Path.join(xdg_data_home, "applications",
"owa-" + WebappOSUtils.getUniqueName(aApp) + ".desktop");
this.installedFiles = [
OS.Path.join(this.installPath, "icon.png"),
OS.Path.join(this.installPath, "webapp.json"),
OS.Path.join(this.installPath, "webapp.ini"),
this.exePath,
desktopINI,
];
this.tempUpdatedFiles = [
OS.Path.join(this.installPath, "update", "icon.png"),
OS.Path.join(this.installPath, "update", "webapp.json"),
OS.Path.join(this.installPath, "update", "webapp.ini"),
];
this.updatedFiles = [
OS.Path.join(this.installPath, "icon.png"),
OS.Path.join(this.installPath, "webapp.json"),
OS.Path.join(this.installPath, "webapp.ini"),
desktopINI,
];
if (this.isPackaged) {
let appZipPath = OS.Path.join(this.installPath, "application.zip");
this.installedFiles.push(appZipPath);
this.tempUpdatedFiles.push(appZipPath);
this.updatedFiles.push(appZipPath);
}
this.profilesIni = OS.Path.join(this.installPath, "profiles.ini");
this.cleanup = Task.async(function*() {
if (this.appProcess && this.appProcess.isRunning) {
this.appProcess.kill();
}
if (this.profileDir) {
yield OS.File.removeDir(this.profileDir.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(this.installPath, { ignoreAbsent: true });
yield OS.File.remove(desktopINI, { ignoreAbsent: true });
});
} else if (WIN) {
this.installPath = OS.Path.join(OS.Constants.Path.winAppDataDir,
WebappOSUtils.getUniqueName(aApp));
this.exePath = OS.Path.join(this.installPath, aApp.name + ".exe");
let desktopShortcut = OS.Path.join(OS.Constants.Path.desktopDir,
aApp.name + ".lnk");
let startMenuShortcut = OS.Path.join(OS.Constants.Path.winStartMenuProgsDir,
aApp.name + ".lnk");
this.installedFiles = [
OS.Path.join(this.installPath, "chrome", "icons", "default", "default.ico"),
OS.Path.join(this.installPath, "webapp.json"),
OS.Path.join(this.installPath, "webapp.ini"),
OS.Path.join(this.installPath, "uninstall", "shortcuts_log.ini"),
OS.Path.join(this.installPath, "uninstall", "uninstall.log"),
OS.Path.join(this.installPath, "uninstall", "webapp-uninstaller.exe"),
this.exePath,
desktopShortcut,
startMenuShortcut,
];
this.tempUpdatedFiles = [
OS.Path.join(this.installPath, "update", "chrome", "icons", "default", "default.ico"),
OS.Path.join(this.installPath, "update", "webapp.json"),
OS.Path.join(this.installPath, "update", "webapp.ini"),
OS.Path.join(this.installPath, "update", "uninstall", "shortcuts_log.ini"),
OS.Path.join(this.installPath, "update", "uninstall", "uninstall.log"),
OS.Path.join(this.installPath, "update", "uninstall", "webapp-uninstaller.exe"),
];
this.updatedFiles = [
OS.Path.join(this.installPath, "chrome", "icons", "default", "default.ico"),
OS.Path.join(this.installPath, "webapp.json"),
OS.Path.join(this.installPath, "webapp.ini"),
OS.Path.join(this.installPath, "uninstall", "shortcuts_log.ini"),
OS.Path.join(this.installPath, "uninstall", "uninstall.log"),
desktopShortcut,
startMenuShortcut,
];
if (this.isPackaged) {
let appZipPath = OS.Path.join(this.installPath, "application.zip");
this.installedFiles.push(appZipPath);
this.tempUpdatedFiles.push(appZipPath);
this.updatedFiles.push(appZipPath);
}
this.profilesIni = OS.Path.join(this.installPath, "profiles.ini");
this.cleanup = Task.async(function*() {
if (this.appProcess && this.appProcess.isRunning) {
this.appProcess.kill();
}
let uninstallKey;
try {
uninstallKey = Cc["@mozilla.org/windows-registry-key;1"].
createInstance(Ci.nsIWindowsRegKey);
uninstallKey.open(uninstallKey.ROOT_KEY_CURRENT_USER,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall",
uninstallKey.ACCESS_WRITE);
if (uninstallKey.hasChild(WebappOSUtils.getUniqueName(aApp))) {
uninstallKey.removeChild(WebappOSUtils.getUniqueName(aApp));
}
} catch (e) {
} finally {
if (uninstallKey) {
uninstallKey.close();
}
}
let removed = false;
do {
try {
if (this.profileDir) {
yield OS.File.removeDir(this.profileDir.parent.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(this.installPath, { ignoreAbsent: true });
yield OS.File.remove(desktopShortcut, { ignoreAbsent: true });
yield OS.File.remove(startMenuShortcut, { ignoreAbsent: true });
removed = true;
} catch (ex if ex instanceof OS.File.Error &&
(ex.winLastError == OS.Constants.Win.ERROR_ACCESS_DENIED ||
ex.winLastError == OS.Constants.Win.ERROR_SHARING_VIOLATION)) {
// Wait 100 ms before attempting to remove again.
yield wait(100);
}
} while (!removed);
});
} else if (MAC) {
this.installPath = OS.Path.join(OS.Constants.Path.homeDir,
"Applications",
aApp.name + ".app");
this.exePath = OS.Path.join(this.installPath, "Contents", "MacOS", "webapprt");
let appProfileDir = OS.Path.join(OS.Constants.Path.macUserLibDir,
"Application Support",
WebappOSUtils.getUniqueName(aApp));
this.installedFiles = [
OS.Path.join(this.installPath, "Contents", "Info.plist"),
OS.Path.join(this.installPath, "Contents", "MacOS", "webapp.ini"),
OS.Path.join(this.installPath, "Contents", "Resources", "appicon.icns"),
OS.Path.join(appProfileDir, "webapp.json"),
this.exePath,
];
this.tempUpdatedFiles = [
OS.Path.join(this.installPath, "update", "Contents", "Info.plist"),
OS.Path.join(this.installPath, "update", "Contents", "MacOS", "webapp.ini"),
OS.Path.join(this.installPath, "update", "Contents", "Resources", "appicon.icns"),
OS.Path.join(this.installPath, "update", "webapp.json")
];
this.updatedFiles = [
OS.Path.join(this.installPath, "Contents", "Info.plist"),
OS.Path.join(this.installPath, "Contents", "MacOS", "webapp.ini"),
OS.Path.join(this.installPath, "Contents", "Resources", "appicon.icns"),
OS.Path.join(appProfileDir, "webapp.json"),
];
if (this.isPackaged) {
let appZipPath = OS.Path.join(this.installPath, "Contents", "Resources", "application.zip");
this.installedFiles.push(appZipPath);
this.tempUpdatedFiles.push(appZipPath);
this.updatedFiles.push(appZipPath);
}
this.profilesIni = OS.Path.join(appProfileDir, "profiles.ini");
this.cleanup = Task.async(function*() {
if (this.appProcess && this.appProcess.isRunning) {
this.appProcess.kill();
}
if (this.profileDir) {
yield OS.File.removeDir(this.profileDir.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(this.installPath, { ignoreAbsent: true });
yield OS.File.removeDir(appProfileDir, { ignoreAbsent: true });
});
}
}
function buildAppPackage(aManifest) {
let zipFile = getFile(OS.Constants.Path.profileDir, "sample.zip");

View File

@ -44,172 +44,13 @@ let app = {
installTime: Date.now(),
};
let profileDir;
let profilesIni;
let installPath;
let installedFiles;
let tempUpdatedFiles;
let updatedFiles;
let cleanup;
if (LINUX) {
installPath = OS.Path.join(OS.Constants.Path.homeDir, "." + WebappOSUtils.getUniqueName(app));
let xdg_data_home = Cc["@mozilla.org/process/environment;1"].
getService(Ci.nsIEnvironment).
get("XDG_DATA_HOME");
if (!xdg_data_home) {
xdg_data_home = OS.Path.join(OS.Constants.Path.homeDir, ".local", "share");
}
let desktopINI = OS.Path.join(xdg_data_home, "applications",
"owa-" + WebappOSUtils.getUniqueName(app) + ".desktop");
installedFiles = [
OS.Path.join(installPath, "icon.png"),
OS.Path.join(installPath, "webapprt-stub"),
OS.Path.join(installPath, "webapp.json"),
OS.Path.join(installPath, "webapp.ini"),
desktopINI,
];
tempUpdatedFiles = [
OS.Path.join(installPath, "update", "icon.png"),
OS.Path.join(installPath, "update", "webapp.json"),
OS.Path.join(installPath, "update", "webapp.ini"),
];
updatedFiles = [
OS.Path.join(installPath, "icon.png"),
OS.Path.join(installPath, "webapp.json"),
OS.Path.join(installPath, "webapp.ini"),
desktopINI,
];
profilesIni = OS.Path.join(installPath, "profiles.ini");
cleanup = function() {
return Task.spawn(function*() {
if (profileDir) {
yield OS.File.removeDir(profileDir.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
yield OS.File.remove(desktopINI, { ignoreAbsent: true });
});
};
} else if (WIN) {
installPath = OS.Path.join(OS.Constants.Path.winAppDataDir, WebappOSUtils.getUniqueName(app));
let desktopShortcut = OS.Path.join(OS.Constants.Path.desktopDir, "Sample hosted app.lnk");
let startMenuShortcut = OS.Path.join(OS.Constants.Path.winStartMenuProgsDir, "Sample hosted app.lnk");
installedFiles = [
OS.Path.join(installPath, "Sample hosted app.exe"),
OS.Path.join(installPath, "chrome", "icons", "default", "default.ico"),
OS.Path.join(installPath, "webapp.json"),
OS.Path.join(installPath, "webapp.ini"),
OS.Path.join(installPath, "uninstall", "shortcuts_log.ini"),
OS.Path.join(installPath, "uninstall", "uninstall.log"),
OS.Path.join(installPath, "uninstall", "webapp-uninstaller.exe"),
desktopShortcut,
startMenuShortcut,
];
tempUpdatedFiles = [
OS.Path.join(installPath, "update", "chrome", "icons", "default", "default.ico"),
OS.Path.join(installPath, "update", "webapp.json"),
OS.Path.join(installPath, "update", "webapp.ini"),
OS.Path.join(installPath, "update", "uninstall", "shortcuts_log.ini"),
OS.Path.join(installPath, "update", "uninstall", "uninstall.log"),
OS.Path.join(installPath, "update", "uninstall", "webapp-uninstaller.exe"),
];
updatedFiles = [
OS.Path.join(installPath, "chrome", "icons", "default", "default.ico"),
OS.Path.join(installPath, "webapp.json"),
OS.Path.join(installPath, "webapp.ini"),
OS.Path.join(installPath, "uninstall", "shortcuts_log.ini"),
OS.Path.join(installPath, "uninstall", "uninstall.log"),
desktopShortcut,
startMenuShortcut,
];
profilesIni = OS.Path.join(installPath, "profiles.ini");
cleanup = function() {
return Task.spawn(function*() {
let uninstallKey;
try {
uninstallKey = Cc["@mozilla.org/windows-registry-key;1"].
createInstance(Ci.nsIWindowsRegKey);
uninstallKey.open(uninstallKey.ROOT_KEY_CURRENT_USER,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall",
uninstallKey.ACCESS_WRITE);
if (uninstallKey.hasChild(WebappOSUtils.getUniqueName(app))) {
uninstallKey.removeChild(WebappOSUtils.getUniqueName(app));
}
} catch (e) {
} finally {
if (uninstallKey) {
uninstallKey.close();
}
}
if (profileDir) {
yield OS.File.removeDir(profileDir.parent.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
yield OS.File.remove(desktopShortcut, { ignoreAbsent: true });
yield OS.File.remove(startMenuShortcut, { ignoreAbsent: true });
});
};
} else if (MAC) {
installPath = OS.Path.join(OS.Constants.Path.homeDir, "Applications", "Sample hosted app.app");
let appProfileDir = OS.Path.join(OS.Constants.Path.macUserLibDir, "Application Support",
WebappOSUtils.getUniqueName(app));
installedFiles = [
OS.Path.join(installPath, "Contents", "Info.plist"),
OS.Path.join(installPath, "Contents", "MacOS", "webapprt"),
OS.Path.join(installPath, "Contents", "MacOS", "webapp.ini"),
OS.Path.join(installPath, "Contents", "Resources", "appicon.icns"),
OS.Path.join(appProfileDir, "webapp.json"),
];
tempUpdatedFiles = [
OS.Path.join(installPath, "update", "Contents", "Info.plist"),
OS.Path.join(installPath, "update", "Contents", "MacOS", "webapp.ini"),
OS.Path.join(installPath, "update", "Contents", "Resources", "appicon.icns"),
OS.Path.join(installPath, "update", "webapp.json")
];
updatedFiles = [
OS.Path.join(installPath, "Contents", "Info.plist"),
OS.Path.join(installPath, "Contents", "MacOS", "webapp.ini"),
OS.Path.join(installPath, "Contents", "Resources", "appicon.icns"),
OS.Path.join(appProfileDir, "webapp.json"),
];
profilesIni = OS.Path.join(appProfileDir, "profiles.ini");
cleanup = function() {
return Task.spawn(function*() {
if (profileDir) {
yield OS.File.removeDir(profileDir.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
yield OS.File.removeDir(appProfileDir, { ignoreAbsent: true });
});
};
}
let testAppInfo = new TestAppInfo(app);
let runTest = Task.async(function*() {
// Get to a clean state before the test
yield cleanup();
yield testAppInfo.cleanup();
SimpleTest.registerCleanupFunction(cleanup);
SimpleTest.registerCleanupFunction(() => testAppInfo.cleanup());
setDryRunPref();
@ -224,9 +65,9 @@ let runTest = Task.async(function*() {
is(ex, "The application isn't installed", "Exception thrown");
}
profileDir = nativeApp.createProfile();
ok(profileDir && profileDir.exists(), "Profile directory created");
ok((yield OS.File.exists(profilesIni)), "profiles.ini file created");
testAppInfo.profileDir = nativeApp.createProfile();
ok(testAppInfo.profileDir && testAppInfo.profileDir.exists(), "Profile directory created");
ok((yield OS.File.exists(testAppInfo.profilesIni)), "profiles.ini file created");
// On Mac build servers, we don't have enough privileges to write to /Applications,
// so we install apps in a user-owned directory.
@ -242,10 +83,10 @@ let runTest = Task.async(function*() {
yield wait(1000);
}
ok(true, "App launchable");
ok((yield checkFiles(installedFiles)), "Files correctly written");
is(WebappOSUtils.getInstallPath(app), installPath, "getInstallPath == installPath");
ok((yield checkFiles(testAppInfo.installedFiles)), "Files correctly written");
is(WebappOSUtils.getInstallPath(app), testAppInfo.installPath, "getInstallPath == installPath");
let stat = yield OS.File.stat(installPath);
let stat = yield OS.File.stat(testAppInfo.installPath);
let installTime = stat.lastModificationDate;
// Wait one second, otherwise the last modification date is the same.
@ -258,19 +99,19 @@ let runTest = Task.async(function*() {
yield wait(1000);
}
ok(true, "App launchable");
ok((yield checkFiles(installedFiles)), "Installation not corrupted");
ok((yield checkFiles(tempUpdatedFiles)), "Files correctly written in the update subdirectory");
ok((yield checkFiles(testAppInfo.installedFiles)), "Installation not corrupted");
ok((yield checkFiles(testAppInfo.tempUpdatedFiles)), "Files correctly written in the update subdirectory");
yield nativeApp.applyUpdate();
while (!WebappOSUtils.isLaunchable(app)) {
yield wait(1000);
}
ok(true, "App launchable");
ok((yield checkFiles(installedFiles)), "Installation not corrupted");
ok(!(yield OS.File.exists(OS.Path.join(installPath, "update"))), "Update directory removed");
ok((yield checkDateHigherThan(updatedFiles, installTime)), "Modification date higher");
ok((yield checkFiles(testAppInfo.installedFiles)), "Installation not corrupted");
ok(!(yield OS.File.exists(OS.Path.join(testAppInfo.installPath, "update"))), "Update directory removed");
ok((yield checkDateHigherThan(testAppInfo.updatedFiles, installTime)), "Modification date higher");
stat = yield OS.File.stat(installPath);
stat = yield OS.File.stat(testAppInfo.installPath);
installTime = stat.lastModificationDate;
// Wait one second, otherwise the last modification date is the same.
@ -283,17 +124,17 @@ let runTest = Task.async(function*() {
yield wait(1000);
}
ok(true, "App launchable");
ok((yield checkFiles(installedFiles)), "Installation not corrupted");
ok((yield checkFiles(tempUpdatedFiles)), "Files correctly written in the update subdirectory");
ok((yield checkFiles(testAppInfo.installedFiles)), "Installation not corrupted");
ok((yield checkFiles(testAppInfo.tempUpdatedFiles)), "Files correctly written in the update subdirectory");
yield nativeApp.applyUpdate();
while (!WebappOSUtils.isLaunchable(app)) {
yield wait(1000);
}
ok(true, "App launchable");
ok((yield checkFiles(installedFiles)), "Installation not corrupted");
ok(!(yield OS.File.exists(OS.Path.join(installPath, "update"))), "Update directory removed");
ok((yield checkDateHigherThan(updatedFiles, installTime)), "Modification date higher");
ok((yield checkFiles(testAppInfo.installedFiles)), "Installation not corrupted");
ok(!(yield OS.File.exists(OS.Path.join(testAppInfo.installPath, "update"))), "Update directory removed");
ok((yield checkDateHigherThan(testAppInfo.updatedFiles, installTime)), "Modification date higher");
SimpleTest.finish();
});

View File

@ -46,132 +46,21 @@ let app = {
installTime: Date.now(),
};
let profileDir;
let installPath;
let exePath;
let appProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
let cleanup;
if (LINUX) {
installPath = OS.Path.join(OS.Constants.Path.homeDir, "." + WebappOSUtils.getUniqueName(app));
exePath = OS.Path.join(installPath, "webapprt-stub");
let xdg_data_home = Cc["@mozilla.org/process/environment;1"].
getService(Ci.nsIEnvironment).
get("XDG_DATA_HOME");
if (!xdg_data_home) {
xdg_data_home = OS.Path.join(OS.Constants.Path.homeDir, ".local", "share");
}
let desktopINI = OS.Path.join(xdg_data_home, "applications",
"owa-" + WebappOSUtils.getUniqueName(app) + ".desktop");
cleanup = function() {
return Task.spawn(function*() {
if (appProcess.isRunning) {
appProcess.kill();
}
if (profileDir) {
yield OS.File.removeDir(profileDir.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
yield OS.File.remove(desktopINI, { ignoreAbsent: true });
});
};
} else if (WIN) {
installPath = OS.Path.join(OS.Constants.Path.winAppDataDir, WebappOSUtils.getUniqueName(app));
exePath = OS.Path.join(installPath, "test_desktop_hosted_launch.exe");
let desktopShortcut = OS.Path.join(OS.Constants.Path.desktopDir, "test_desktop_hosted_launch.lnk");
let startMenuShortcut = OS.Path.join(OS.Constants.Path.winStartMenuProgsDir, "test_desktop_hosted_launch.lnk");
cleanup = function() {
return Task.spawn(function*() {
if (appProcess.isRunning) {
appProcess.kill();
}
let uninstallKey;
try {
uninstallKey = Cc["@mozilla.org/windows-registry-key;1"].
createInstance(Ci.nsIWindowsRegKey);
uninstallKey.open(uninstallKey.ROOT_KEY_CURRENT_USER,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall",
uninstallKey.ACCESS_WRITE);
if (uninstallKey.hasChild(WebappOSUtils.getUniqueName(app))) {
uninstallKey.removeChild(WebappOSUtils.getUniqueName(app));
}
} catch (e) {
} finally {
if (uninstallKey) {
uninstallKey.close();
}
}
let removed = false;
do {
try {
if (profileDir) {
yield OS.File.removeDir(profileDir.parent.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
yield OS.File.remove(desktopShortcut, { ignoreAbsent: true });
yield OS.File.remove(startMenuShortcut, { ignoreAbsent: true });
removed = true;
} catch (ex if ex instanceof OS.File.Error &&
(ex.winLastError == OS.Constants.Win.ERROR_ACCESS_DENIED ||
ex.winLastError == OS.Constants.Win.ERROR_SHARING_VIOLATION)) {
// Wait 100 ms before attempting to remove again.
yield wait(100);
}
} while (!removed);
});
};
} else if (MAC) {
installPath = OS.Path.join(OS.Constants.Path.homeDir, "Applications", "test_desktop_hosted_launch.app");
exePath = OS.Path.join(installPath, "Contents", "MacOS", "webapprt");
let appProfileDir = OS.Path.join(OS.Constants.Path.macUserLibDir, "Application Support",
WebappOSUtils.getUniqueName(app));
cleanup = function() {
return Task.spawn(function*() {
if (appProcess.isRunning) {
appProcess.kill();
}
if (profileDir) {
yield OS.File.removeDir(profileDir.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
yield OS.File.removeDir(appProfileDir, { ignoreAbsent: true });
});
};
}
let testAppInfo = new TestAppInfo(app);
let runTest = Task.async(function*() {
// Get to a clean state before the test
yield cleanup();
yield testAppInfo.cleanup();
SimpleTest.registerCleanupFunction(cleanup);
SimpleTest.registerCleanupFunction(() => testAppInfo.cleanup());
setDryRunPref();
let nativeApp = new NativeApp(app, manifest, app.categories);
ok(nativeApp, "NativeApp object created");
profileDir = nativeApp.createProfile();
ok(profileDir && profileDir.exists(), "Profile directory created");
testAppInfo.profileDir = nativeApp.createProfile();
ok(testAppInfo.profileDir && testAppInfo.profileDir.exists(), "Profile directory created");
// On Mac build servers, we don't have enough privileges to write to /Applications,
// so we install apps in a user-owned directory.
@ -188,14 +77,14 @@ let runTest = Task.async(function*() {
}
ok(true, "App launchable");
let exeFile = getFile(exePath);
let exeFile = getFile(testAppInfo.exePath);
ok(exeFile.isExecutable(), "webapprt executable is executable");
let appClosed = false;
appProcess.init(exeFile)
appProcess.runAsync([], 0, () => appClosed = true);
testAppInfo.appProcess.init(exeFile)
testAppInfo.appProcess.runAsync([], 0, () => appClosed = true);
while (!(yield wasAppSJSAccessed()) && !appClosed) {
yield wait(1000);

View File

@ -46,132 +46,21 @@ let app = {
installTime: Date.now(),
};
let profileDir;
let installPath;
let exePath;
let appProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
let cleanup;
if (LINUX) {
installPath = OS.Path.join(OS.Constants.Path.homeDir, "." + WebappOSUtils.getUniqueName(app));
exePath = OS.Path.join(installPath, "webapprt-stub");
let xdg_data_home = Cc["@mozilla.org/process/environment;1"].
getService(Ci.nsIEnvironment).
get("XDG_DATA_HOME");
if (!xdg_data_home) {
xdg_data_home = OS.Path.join(OS.Constants.Path.homeDir, ".local", "share");
}
let desktopINI = OS.Path.join(xdg_data_home, "applications",
"owa-" + WebappOSUtils.getUniqueName(app) + ".desktop");
cleanup = function() {
return Task.spawn(function*() {
if (appProcess.isRunning) {
appProcess.kill();
}
if (profileDir) {
yield OS.File.removeDir(profileDir.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
yield OS.File.remove(desktopINI, { ignoreAbsent: true });
});
};
} else if (WIN) {
installPath = OS.Path.join(OS.Constants.Path.winAppDataDir, WebappOSUtils.getUniqueName(app));
exePath = OS.Path.join(installPath, "test_desktop_hosted_launch_no_registry.exe");
let desktopShortcut = OS.Path.join(OS.Constants.Path.desktopDir, "test_desktop_hosted_launch_no_registry.lnk");
let startMenuShortcut = OS.Path.join(OS.Constants.Path.winStartMenuProgsDir, "test_desktop_hosted_launch_no_registry.lnk");
cleanup = function() {
return Task.spawn(function*() {
if (appProcess.isRunning) {
appProcess.kill();
}
let uninstallKey;
try {
uninstallKey = Cc["@mozilla.org/windows-registry-key;1"].
createInstance(Ci.nsIWindowsRegKey);
uninstallKey.open(uninstallKey.ROOT_KEY_CURRENT_USER,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall",
uninstallKey.ACCESS_WRITE);
if (uninstallKey.hasChild(WebappOSUtils.getUniqueName(app))) {
uninstallKey.removeChild(WebappOSUtils.getUniqueName(app));
}
} catch (e) {
} finally {
if (uninstallKey) {
uninstallKey.close();
}
}
let removed = false;
do {
try {
if (profileDir) {
yield OS.File.removeDir(profileDir.parent.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
yield OS.File.remove(desktopShortcut, { ignoreAbsent: true });
yield OS.File.remove(startMenuShortcut, { ignoreAbsent: true });
removed = true;
} catch (ex if ex instanceof OS.File.Error &&
(ex.winLastError == OS.Constants.Win.ERROR_ACCESS_DENIED ||
ex.winLastError == OS.Constants.Win.ERROR_SHARING_VIOLATION)) {
// Wait 100 ms before attempting to remove again.
yield wait(100);
}
} while (!removed);
});
};
} else if (MAC) {
installPath = OS.Path.join(OS.Constants.Path.homeDir, "Applications", "test_desktop_hosted_launch_no_registry.app");
exePath = OS.Path.join(installPath, "Contents", "MacOS", "webapprt");
let appProfileDir = OS.Path.join(OS.Constants.Path.macUserLibDir, "Application Support",
WebappOSUtils.getUniqueName(app));
cleanup = function() {
return Task.spawn(function*() {
if (appProcess.isRunning) {
appProcess.kill();
}
if (profileDir) {
yield OS.File.removeDir(profileDir.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
yield OS.File.removeDir(appProfileDir, { ignoreAbsent: true });
});
};
}
let testAppInfo = new TestAppInfo(app);
let runTest = Task.async(function*() {
// Get to a clean state before the test
yield cleanup();
yield testAppInfo.cleanup();
SimpleTest.registerCleanupFunction(cleanup);
SimpleTest.registerCleanupFunction(() => testAppInfo.cleanup());
setDryRunPref();
let nativeApp = new NativeApp(app, manifest, app.categories);
ok(nativeApp, "NativeApp object created");
profileDir = nativeApp.createProfile();
ok(profileDir && profileDir.exists(), "Profile directory created");
testAppInfo.profileDir = nativeApp.createProfile();
ok(testAppInfo.profileDir && testAppInfo.profileDir.exists(), "Profile directory created");
// On Mac build servers, we don't have enough privileges to write to /Applications,
// so we install apps in a user-owned directory.
@ -188,14 +77,14 @@ let runTest = Task.async(function*() {
}
ok(true, "App launchable");
let exeFile = getFile(exePath);
let exeFile = getFile(testAppInfo.exePath);
ok(exeFile.isExecutable(), "webapprt executable is executable");
let appClosed = false;
appProcess.init(exeFile)
appProcess.runAsync([], 0, () => appClosed = true);
testAppInfo.appProcess.init(exeFile)
testAppInfo.appProcess.runAsync([], 0, () => appClosed = true);
while (!(yield wasAppSJSAccessed()) && !appClosed) {
yield wait(1000);

View File

@ -51,132 +51,21 @@ let app = {
installTime: Date.now(),
};
let profileDir;
let installPath;
let exePath;
let appProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
let cleanup;
if (LINUX) {
installPath = OS.Path.join(OS.Constants.Path.homeDir, "." + WebappOSUtils.getUniqueName(app));
exePath = OS.Path.join(installPath, "webapprt-stub");
let xdg_data_home = Cc["@mozilla.org/process/environment;1"].
getService(Ci.nsIEnvironment).
get("XDG_DATA_HOME");
if (!xdg_data_home) {
xdg_data_home = OS.Path.join(OS.Constants.Path.homeDir, ".local", "share");
}
let desktopINI = OS.Path.join(xdg_data_home, "applications",
"owa-" + WebappOSUtils.getUniqueName(app) + ".desktop");
cleanup = function() {
return Task.spawn(function*() {
if (appProcess.isRunning) {
appProcess.kill();
}
if (profileDir) {
yield OS.File.removeDir(profileDir.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
yield OS.File.remove(desktopINI, { ignoreAbsent: true });
});
};
} else if (WIN) {
installPath = OS.Path.join(OS.Constants.Path.winAppDataDir, WebappOSUtils.getUniqueName(app));
exePath = OS.Path.join(installPath, "test_desktop_hosted_launch.exe");
let desktopShortcut = OS.Path.join(OS.Constants.Path.desktopDir, "test_desktop_hosted_launch.lnk");
let startMenuShortcut = OS.Path.join(OS.Constants.Path.winStartMenuProgsDir, "test_desktop_hosted_launch.lnk");
cleanup = function() {
return Task.spawn(function*() {
if (appProcess.isRunning) {
appProcess.kill();
}
let uninstallKey;
try {
uninstallKey = Cc["@mozilla.org/windows-registry-key;1"].
createInstance(Ci.nsIWindowsRegKey);
uninstallKey.open(uninstallKey.ROOT_KEY_CURRENT_USER,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall",
uninstallKey.ACCESS_WRITE);
if (uninstallKey.hasChild(WebappOSUtils.getUniqueName(app))) {
uninstallKey.removeChild(WebappOSUtils.getUniqueName(app));
}
} catch (e) {
} finally {
if (uninstallKey) {
uninstallKey.close();
}
}
let removed = false;
do {
try {
if (profileDir) {
yield OS.File.removeDir(profileDir.parent.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
yield OS.File.remove(desktopShortcut, { ignoreAbsent: true });
yield OS.File.remove(startMenuShortcut, { ignoreAbsent: true });
removed = true;
} catch (ex if ex instanceof OS.File.Error &&
(ex.winLastError == OS.Constants.Win.ERROR_ACCESS_DENIED ||
ex.winLastError == OS.Constants.Win.ERROR_SHARING_VIOLATION)) {
// Wait 100 ms before attempting to remove again.
yield wait(100);
}
} while (!removed);
});
};
} else if (MAC) {
installPath = OS.Path.join(OS.Constants.Path.homeDir, "Applications", "test_desktop_hosted_launch.app");
exePath = OS.Path.join(installPath, "Contents", "MacOS", "webapprt");
let appProfileDir = OS.Path.join(OS.Constants.Path.macUserLibDir, "Application Support",
WebappOSUtils.getUniqueName(app));
cleanup = function() {
return Task.spawn(function*() {
if (appProcess.isRunning) {
appProcess.kill();
}
if (profileDir) {
yield OS.File.removeDir(profileDir.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
yield OS.File.removeDir(appProfileDir, { ignoreAbsent: true });
});
};
}
let testAppInfo = new TestAppInfo(app);
let runTest = Task.async(function*() {
// Get to a clean state before the test
yield cleanup();
yield testAppInfo.cleanup();
SimpleTest.registerCleanupFunction(cleanup);
SimpleTest.registerCleanupFunction(() => testAppInfo.cleanup());
setDryRunPref();
let nativeApp = new NativeApp(app, manifest, app.categories);
ok(nativeApp, "NativeApp object created");
profileDir = nativeApp.createProfile();
ok(profileDir && profileDir.exists(), "Profile directory created");
testAppInfo.profileDir = nativeApp.createProfile();
ok(testAppInfo.profileDir && testAppInfo.profileDir.exists(), "Profile directory created");
// On Mac build servers, we don't have enough privileges to write to /Applications,
// so we install apps in a user-owned directory.
@ -205,14 +94,14 @@ let runTest = Task.async(function*() {
// accessed only if the app is actually updated (because the old manifest
// contained a different launch path).
let exeFile = getFile(exePath);
let exeFile = getFile(testAppInfo.exePath);
ok(exeFile.isExecutable(), "webapprt executable is executable");
let appClosed = false;
appProcess.init(exeFile)
appProcess.runAsync([], 0, () => appClosed = true);
testAppInfo.appProcess.init(exeFile)
testAppInfo.appProcess.runAsync([], 0, () => appClosed = true);
while (!(yield wasAppSJSAccessed()) && !appClosed) {
yield wait(1000);

View File

@ -50,181 +50,13 @@ let app = {
installTime: Date.now(),
};
let profileDir;
let profilesIni;
let installPath;
let installedFiles;
let tempUpdatedFiles;
let updatedFiles;
let cleanup;
if (LINUX) {
installPath = OS.Path.join(OS.Constants.Path.homeDir, "." + WebappOSUtils.getUniqueName(app));
let xdg_data_home = Cc["@mozilla.org/process/environment;1"].
getService(Ci.nsIEnvironment).
get("XDG_DATA_HOME");
if (!xdg_data_home) {
xdg_data_home = OS.Path.join(OS.Constants.Path.homeDir, ".local", "share");
}
let desktopINI = OS.Path.join(xdg_data_home, "applications",
"owa-" + WebappOSUtils.getUniqueName(app) + ".desktop");
installedFiles = [
OS.Path.join(installPath, "icon.png"),
OS.Path.join(installPath, "webapprt-stub"),
OS.Path.join(installPath, "webapp.json"),
OS.Path.join(installPath, "webapp.ini"),
OS.Path.join(installPath, "application.zip"),
desktopINI,
];
tempUpdatedFiles = [
OS.Path.join(installPath, "update", "icon.png"),
OS.Path.join(installPath, "update", "webapp.json"),
OS.Path.join(installPath, "update", "webapp.ini"),
OS.Path.join(installPath, "update", "application.zip"),
];
updatedFiles = [
OS.Path.join(installPath, "icon.png"),
OS.Path.join(installPath, "webapp.json"),
OS.Path.join(installPath, "webapp.ini"),
OS.Path.join(installPath, "application.zip"),
desktopINI,
];
profilesIni = OS.Path.join(installPath, "profiles.ini");
cleanup = function() {
return Task.spawn(function*() {
if (profileDir) {
yield OS.File.removeDir(profileDir.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
yield OS.File.remove(desktopINI, { ignoreAbsent: true });
});
};
} else if (WIN) {
installPath = OS.Path.join(OS.Constants.Path.winAppDataDir, WebappOSUtils.getUniqueName(app));
let desktopShortcut = OS.Path.join(OS.Constants.Path.desktopDir, "Sample packaged app.lnk");
let startMenuShortcut = OS.Path.join(OS.Constants.Path.winStartMenuProgsDir, "Sample packaged app.lnk");
installedFiles = [
OS.Path.join(installPath, "Sample packaged app.exe"),
OS.Path.join(installPath, "chrome", "icons", "default", "default.ico"),
OS.Path.join(installPath, "webapp.json"),
OS.Path.join(installPath, "webapp.ini"),
OS.Path.join(installPath, "application.zip"),
OS.Path.join(installPath, "uninstall", "shortcuts_log.ini"),
OS.Path.join(installPath, "uninstall", "uninstall.log"),
OS.Path.join(installPath, "uninstall", "webapp-uninstaller.exe"),
desktopShortcut,
startMenuShortcut,
];
tempUpdatedFiles = [
OS.Path.join(installPath, "update", "chrome", "icons", "default", "default.ico"),
OS.Path.join(installPath, "update", "webapp.json"),
OS.Path.join(installPath, "update", "webapp.ini"),
OS.Path.join(installPath, "update", "application.zip"),
OS.Path.join(installPath, "update", "uninstall", "shortcuts_log.ini"),
OS.Path.join(installPath, "update", "uninstall", "uninstall.log"),
OS.Path.join(installPath, "update", "uninstall", "webapp-uninstaller.exe"),
];
updatedFiles = [
OS.Path.join(installPath, "chrome", "icons", "default", "default.ico"),
OS.Path.join(installPath, "webapp.json"),
OS.Path.join(installPath, "webapp.ini"),
OS.Path.join(installPath, "application.zip"),
OS.Path.join(installPath, "uninstall", "shortcuts_log.ini"),
OS.Path.join(installPath, "uninstall", "uninstall.log"),
desktopShortcut,
startMenuShortcut,
];
profilesIni = OS.Path.join(installPath, "profiles.ini");
cleanup = function() {
return Task.spawn(function*() {
let uninstallKey;
try {
uninstallKey = Cc["@mozilla.org/windows-registry-key;1"].
createInstance(Ci.nsIWindowsRegKey);
uninstallKey.open(uninstallKey.ROOT_KEY_CURRENT_USER,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall",
uninstallKey.ACCESS_WRITE);
if (uninstallKey.hasChild(WebappOSUtils.getUniqueName(app))) {
uninstallKey.removeChild(WebappOSUtils.getUniqueName(app));
}
} catch (e) {
} finally {
if (uninstallKey) {
uninstallKey.close();
}
}
if (profileDir) {
yield OS.File.removeDir(profileDir.parent.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
yield OS.File.remove(desktopShortcut, { ignoreAbsent: true });
yield OS.File.remove(startMenuShortcut, { ignoreAbsent: true });
});
};
} else if (MAC) {
installPath = OS.Path.join(OS.Constants.Path.homeDir, "Applications", "Sample packaged app.app");
let appProfileDir = OS.Path.join(OS.Constants.Path.macUserLibDir, "Application Support",
WebappOSUtils.getUniqueName(app));
installedFiles = [
OS.Path.join(installPath, "Contents", "Info.plist"),
OS.Path.join(installPath, "Contents", "MacOS", "webapprt"),
OS.Path.join(installPath, "Contents", "MacOS", "webapp.ini"),
OS.Path.join(installPath, "Contents", "Resources", "appicon.icns"),
OS.Path.join(installPath, "Contents", "Resources", "application.zip"),
OS.Path.join(appProfileDir, "webapp.json"),
];
tempUpdatedFiles = [
OS.Path.join(installPath, "update", "Contents", "Info.plist"),
OS.Path.join(installPath, "update", "Contents", "MacOS", "webapp.ini"),
OS.Path.join(installPath, "update", "Contents", "Resources", "appicon.icns"),
OS.Path.join(installPath, "update", "Contents", "Resources", "application.zip"),
OS.Path.join(installPath, "update", "webapp.json"),
];
updatedFiles = [
OS.Path.join(installPath, "Contents", "Info.plist"),
OS.Path.join(installPath, "Contents", "MacOS", "webapp.ini"),
OS.Path.join(installPath, "Contents", "Resources", "appicon.icns"),
OS.Path.join(installPath, "Contents", "Resources", "application.zip"),
OS.Path.join(appProfileDir, "webapp.json"),
];
profilesIni = OS.Path.join(appProfileDir, "profiles.ini");
cleanup = function() {
return Task.spawn(function*() {
if (profileDir) {
yield OS.File.removeDir(profileDir.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
yield OS.File.removeDir(appProfileDir, { ignoreAbsent: true });
});
};
}
let testAppInfo = new TestAppInfo(app);
let runTest = Task.async(function*() {
// Get to a clean state before the test
yield cleanup();
yield testAppInfo.cleanup();
SimpleTest.registerCleanupFunction(cleanup);
SimpleTest.registerCleanupFunction(() => testAppInfo.cleanup());
setDryRunPref();
@ -242,9 +74,9 @@ let runTest = Task.async(function*() {
is(ex, "The application isn't installed", "Exception thrown");
}
profileDir = nativeApp.createProfile();
ok(profileDir && profileDir.exists(), "Profile directory created");
ok((yield OS.File.exists(profilesIni)), "profiles.ini file created");
testAppInfo.profileDir = nativeApp.createProfile();
ok(testAppInfo.profileDir && testAppInfo.profileDir.exists(), "Profile directory created");
ok((yield OS.File.exists(testAppInfo.profilesIni)), "profiles.ini file created");
// On Mac build servers, we don't have enough privileges to write to /Applications,
// so we install apps in a user-owned directory.
@ -260,10 +92,10 @@ let runTest = Task.async(function*() {
yield wait(1000);
}
ok(true, "App launchable");
ok((yield checkFiles(installedFiles)), "Files correctly written");
is(WebappOSUtils.getInstallPath(app), installPath, "getInstallPath == installPath");
ok((yield checkFiles(testAppInfo.installedFiles)), "Files correctly written");
is(WebappOSUtils.getInstallPath(app), testAppInfo.installPath, "getInstallPath == installPath");
let stat = yield OS.File.stat(installPath);
let stat = yield OS.File.stat(testAppInfo.installPath);
let installTime = stat.lastModificationDate;
// Wait one second, otherwise the last modification date is the same.
@ -280,19 +112,19 @@ let runTest = Task.async(function*() {
yield wait(1000);
}
ok(true, "App launchable");
ok((yield checkFiles(installedFiles)), "Installation not corrupted");
ok((yield checkFiles(tempUpdatedFiles)), "Files correctly written in the update subdirectory");
ok((yield checkFiles(testAppInfo.installedFiles)), "Installation not corrupted");
ok((yield checkFiles(testAppInfo.tempUpdatedFiles)), "Files correctly written in the update subdirectory");
yield nativeApp.applyUpdate();
while (!WebappOSUtils.isLaunchable(app)) {
yield wait(1000);
}
ok(true, "App launchable");
ok((yield checkFiles(installedFiles)), "Installation not corrupted");
ok(!(yield OS.File.exists(OS.Path.join(installPath, "update"))), "Update directory removed");
ok((yield checkDateHigherThan(updatedFiles, installTime)), "Modification date higher");
ok((yield checkFiles(testAppInfo.installedFiles)), "Installation not corrupted");
ok(!(yield OS.File.exists(OS.Path.join(testAppInfo.installPath, "update"))), "Update directory removed");
ok((yield checkDateHigherThan(testAppInfo.updatedFiles, installTime)), "Modification date higher");
stat = yield OS.File.stat(installPath);
stat = yield OS.File.stat(testAppInfo.installPath);
installTime = stat.lastModificationDate;
// Wait one second, otherwise the last modification date is the same.
@ -309,17 +141,17 @@ let runTest = Task.async(function*() {
yield wait(1000);
}
ok(true, "App launchable");
ok((yield checkFiles(installedFiles)), "Installation not corrupted");
ok((yield checkFiles(tempUpdatedFiles)), "Files correctly written in the update subdirectory");
ok((yield checkFiles(testAppInfo.installedFiles)), "Installation not corrupted");
ok((yield checkFiles(testAppInfo.tempUpdatedFiles)), "Files correctly written in the update subdirectory");
yield nativeApp.applyUpdate();
while (!WebappOSUtils.isLaunchable(app)) {
yield wait(1000);
}
ok(true, "App launchable");
ok((yield checkFiles(installedFiles)), "Installation not corrupted");
ok(!(yield OS.File.exists(OS.Path.join(installPath, "update"))), "Update directory removed");
ok((yield checkDateHigherThan(updatedFiles, installTime)), "Modification date higher");
ok((yield checkFiles(testAppInfo.installedFiles)), "Installation not corrupted");
ok(!(yield OS.File.exists(OS.Path.join(testAppInfo.installPath, "update"))), "Update directory removed");
ok((yield checkDateHigherThan(testAppInfo.updatedFiles, installTime)), "Modification date higher");
SimpleTest.finish();
});

View File

@ -56,124 +56,13 @@ let app = {
installTime: Date.now(),
};
let profileDir;
let installPath;
let exePath;
let appProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
let cleanup;
if (LINUX) {
installPath = OS.Path.join(OS.Constants.Path.homeDir, "." + WebappOSUtils.getUniqueName(app));
exePath = OS.Path.join(installPath, "webapprt-stub");
let xdg_data_home = Cc["@mozilla.org/process/environment;1"].
getService(Ci.nsIEnvironment).
get("XDG_DATA_HOME");
if (!xdg_data_home) {
xdg_data_home = OS.Path.join(OS.Constants.Path.homeDir, ".local", "share");
}
let desktopINI = OS.Path.join(xdg_data_home, "applications",
"owa-" + WebappOSUtils.getUniqueName(app) + ".desktop");
cleanup = function() {
return Task.spawn(function*() {
if (appProcess.isRunning) {
appProcess.kill();
}
if (profileDir) {
yield OS.File.removeDir(profileDir.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
yield OS.File.remove(desktopINI, { ignoreAbsent: true });
});
};
} else if (WIN) {
installPath = OS.Path.join(OS.Constants.Path.winAppDataDir, WebappOSUtils.getUniqueName(app));
exePath = OS.Path.join(installPath, "test_desktop_packaged_launch.exe");
let desktopShortcut = OS.Path.join(OS.Constants.Path.desktopDir, "test_desktop_packaged_launch.lnk");
let startMenuShortcut = OS.Path.join(OS.Constants.Path.winStartMenuProgsDir, "test_desktop_packaged_launch.lnk");
cleanup = function() {
return Task.spawn(function*() {
if (appProcess.isRunning) {
appProcess.kill();
}
let uninstallKey;
try {
uninstallKey = Cc["@mozilla.org/windows-registry-key;1"].
createInstance(Ci.nsIWindowsRegKey);
uninstallKey.open(uninstallKey.ROOT_KEY_CURRENT_USER,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall",
uninstallKey.ACCESS_WRITE);
if (uninstallKey.hasChild(WebappOSUtils.getUniqueName(app))) {
uninstallKey.removeChild(WebappOSUtils.getUniqueName(app));
}
} catch (e) {
} finally {
if (uninstallKey) {
uninstallKey.close();
}
}
let removed = false;
do {
try {
if (profileDir) {
yield OS.File.removeDir(profileDir.parent.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
yield OS.File.remove(desktopShortcut, { ignoreAbsent: true });
yield OS.File.remove(startMenuShortcut, { ignoreAbsent: true });
removed = true;
} catch (ex if ex instanceof OS.File.Error &&
(ex.winLastError == OS.Constants.Win.ERROR_ACCESS_DENIED ||
ex.winLastError == OS.Constants.Win.ERROR_SHARING_VIOLATION)) {
// Wait 100 ms before attempting to remove again.
yield wait(100);
}
} while (!removed);
});
};
} else if (MAC) {
installPath = OS.Path.join(OS.Constants.Path.homeDir, "Applications", "test_desktop_packaged_launch.app");
exePath = OS.Path.join(installPath, "Contents", "MacOS", "webapprt");
let appProfileDir = OS.Path.join(OS.Constants.Path.macUserLibDir, "Application Support",
WebappOSUtils.getUniqueName(app));
cleanup = function() {
return Task.spawn(function*() {
if (appProcess.isRunning) {
appProcess.kill();
}
if (profileDir) {
yield OS.File.removeDir(profileDir.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
yield OS.File.removeDir(appProfileDir, { ignoreAbsent: true });
});
};
}
let testAppInfo = new TestAppInfo(app);
let runTest = Task.async(function*() {
// Get to a clean state before the test
yield cleanup();
yield testAppInfo.cleanup();
SimpleTest.registerCleanupFunction(cleanup);
SimpleTest.registerCleanupFunction(() => testAppInfo.cleanup());
setDryRunPref();
@ -182,8 +71,8 @@ let runTest = Task.async(function*() {
let nativeApp = new NativeApp(app, manifest, app.categories);
ok(nativeApp, "NativeApp object created");
profileDir = nativeApp.createProfile();
ok(profileDir && profileDir.exists(), "Profile directory created");
testAppInfo.profileDir = nativeApp.createProfile();
ok(testAppInfo.profileDir && testAppInfo.profileDir.exists(), "Profile directory created");
// On Mac build servers, we don't have enough privileges to write to /Applications,
// so we install apps in a user-owned directory.
@ -200,14 +89,14 @@ let runTest = Task.async(function*() {
}
ok(true, "App launchable");
let exeFile = getFile(exePath);
let exeFile = getFile(testAppInfo.exePath);
ok(exeFile.isExecutable(), "webapprt executable is executable");
let appClosed = false;
appProcess.init(exeFile)
appProcess.runAsync([], 0, () => appClosed = true);
testAppInfo.appProcess.init(exeFile)
testAppInfo.appProcess.runAsync([], 0, () => appClosed = true);
while (!(yield wasAppSJSAccessed()) && !appClosed) {
yield wait(1000);

View File

@ -56,124 +56,13 @@ let app = {
installTime: Date.now(),
};
let profileDir;
let installPath;
let exePath;
let appProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
let cleanup;
if (LINUX) {
installPath = OS.Path.join(OS.Constants.Path.homeDir, "." + WebappOSUtils.getUniqueName(app));
exePath = OS.Path.join(installPath, "webapprt-stub");
let xdg_data_home = Cc["@mozilla.org/process/environment;1"].
getService(Ci.nsIEnvironment).
get("XDG_DATA_HOME");
if (!xdg_data_home) {
xdg_data_home = OS.Path.join(OS.Constants.Path.homeDir, ".local", "share");
}
let desktopINI = OS.Path.join(xdg_data_home, "applications",
"owa-" + WebappOSUtils.getUniqueName(app) + ".desktop");
cleanup = function() {
return Task.spawn(function*() {
if (appProcess.isRunning) {
appProcess.kill();
}
if (profileDir) {
yield OS.File.removeDir(profileDir.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
yield OS.File.remove(desktopINI, { ignoreAbsent: true });
});
};
} else if (WIN) {
installPath = OS.Path.join(OS.Constants.Path.winAppDataDir, WebappOSUtils.getUniqueName(app));
exePath = OS.Path.join(installPath, "test_desktop_packaged_launch_no_registry.exe");
let desktopShortcut = OS.Path.join(OS.Constants.Path.desktopDir, "test_desktop_packaged_launch_no_registry.lnk");
let startMenuShortcut = OS.Path.join(OS.Constants.Path.winStartMenuProgsDir, "test_desktop_packaged_launch_no_registry.lnk");
cleanup = function() {
return Task.spawn(function*() {
if (appProcess.isRunning) {
appProcess.kill();
}
let uninstallKey;
try {
uninstallKey = Cc["@mozilla.org/windows-registry-key;1"].
createInstance(Ci.nsIWindowsRegKey);
uninstallKey.open(uninstallKey.ROOT_KEY_CURRENT_USER,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall",
uninstallKey.ACCESS_WRITE);
if (uninstallKey.hasChild(WebappOSUtils.getUniqueName(app))) {
uninstallKey.removeChild(WebappOSUtils.getUniqueName(app));
}
} catch (e) {
} finally {
if (uninstallKey) {
uninstallKey.close();
}
}
let removed = false;
do {
try {
if (profileDir) {
yield OS.File.removeDir(profileDir.parent.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
yield OS.File.remove(desktopShortcut, { ignoreAbsent: true });
yield OS.File.remove(startMenuShortcut, { ignoreAbsent: true });
removed = true;
} catch (ex if ex instanceof OS.File.Error &&
(ex.winLastError == OS.Constants.Win.ERROR_ACCESS_DENIED ||
ex.winLastError == OS.Constants.Win.ERROR_SHARING_VIOLATION)) {
// Wait 100 ms before attempting to remove again.
yield wait(100);
}
} while (!removed);
});
};
} else if (MAC) {
installPath = OS.Path.join(OS.Constants.Path.homeDir, "Applications", "test_desktop_packaged_launch_no_registry.app");
exePath = OS.Path.join(installPath, "Contents", "MacOS", "webapprt");
let appProfileDir = OS.Path.join(OS.Constants.Path.macUserLibDir, "Application Support",
WebappOSUtils.getUniqueName(app));
cleanup = function() {
return Task.spawn(function*() {
if (appProcess.isRunning) {
appProcess.kill();
}
if (profileDir) {
yield OS.File.removeDir(profileDir.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
yield OS.File.removeDir(appProfileDir, { ignoreAbsent: true });
});
};
}
let testAppInfo = new TestAppInfo(app);
let runTest = Task.async(function*() {
// Get to a clean state before the test
yield cleanup();
yield testAppInfo.cleanup();
SimpleTest.registerCleanupFunction(cleanup);
SimpleTest.registerCleanupFunction(() => testAppInfo.cleanup());
setDryRunPref();
@ -182,8 +71,8 @@ let runTest = Task.async(function*() {
let nativeApp = new NativeApp(app, manifest, app.categories);
ok(nativeApp, "NativeApp object created");
profileDir = nativeApp.createProfile();
ok(profileDir && profileDir.exists(), "Profile directory created");
testAppInfo.profileDir = nativeApp.createProfile();
ok(testAppInfo.profileDir && testAppInfo.profileDir.exists(), "Profile directory created");
// On Mac build servers, we don't have enough privileges to write to /Applications,
// so we install apps in a user-owned directory.
@ -200,14 +89,14 @@ let runTest = Task.async(function*() {
}
ok(true, "App launchable");
let exeFile = getFile(exePath);
let exeFile = getFile(testAppInfo.exePath);
ok(exeFile.isExecutable(), "webapprt executable is executable");
let appClosed = false;
appProcess.init(exeFile)
appProcess.runAsync([], 0, () => appClosed = true);
testAppInfo.appProcess.init(exeFile)
testAppInfo.appProcess.runAsync([], 0, () => appClosed = true);
while (!(yield wasAppSJSAccessed()) && !appClosed) {
yield wait(1000);

View File

@ -64,124 +64,13 @@ let app = {
installTime: Date.now(),
};
let profileDir;
let installPath;
let exePath;
let appProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
let cleanup;
if (LINUX) {
installPath = OS.Path.join(OS.Constants.Path.homeDir, "." + WebappOSUtils.getUniqueName(app));
exePath = OS.Path.join(installPath, "webapprt-stub");
let xdg_data_home = Cc["@mozilla.org/process/environment;1"].
getService(Ci.nsIEnvironment).
get("XDG_DATA_HOME");
if (!xdg_data_home) {
xdg_data_home = OS.Path.join(OS.Constants.Path.homeDir, ".local", "share");
}
let desktopINI = OS.Path.join(xdg_data_home, "applications",
"owa-" + WebappOSUtils.getUniqueName(app) + ".desktop");
cleanup = function() {
return Task.spawn(function*() {
if (appProcess.isRunning) {
appProcess.kill();
}
if (profileDir) {
yield OS.File.removeDir(profileDir.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
yield OS.File.remove(desktopINI, { ignoreAbsent: true });
});
};
} else if (WIN) {
installPath = OS.Path.join(OS.Constants.Path.winAppDataDir, WebappOSUtils.getUniqueName(app));
exePath = OS.Path.join(installPath, "test_desktop_packaged_launch.exe");
let desktopShortcut = OS.Path.join(OS.Constants.Path.desktopDir, "test_desktop_packaged_launch.lnk");
let startMenuShortcut = OS.Path.join(OS.Constants.Path.winStartMenuProgsDir, "test_desktop_packaged_launch.lnk");
cleanup = function() {
return Task.spawn(function*() {
if (appProcess.isRunning) {
appProcess.kill();
}
let uninstallKey;
try {
uninstallKey = Cc["@mozilla.org/windows-registry-key;1"].
createInstance(Ci.nsIWindowsRegKey);
uninstallKey.open(uninstallKey.ROOT_KEY_CURRENT_USER,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall",
uninstallKey.ACCESS_WRITE);
if (uninstallKey.hasChild(WebappOSUtils.getUniqueName(app))) {
uninstallKey.removeChild(WebappOSUtils.getUniqueName(app));
}
} catch (e) {
} finally {
if (uninstallKey) {
uninstallKey.close();
}
}
let removed = false;
do {
try {
if (profileDir) {
yield OS.File.removeDir(profileDir.parent.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
yield OS.File.remove(desktopShortcut, { ignoreAbsent: true });
yield OS.File.remove(startMenuShortcut, { ignoreAbsent: true });
removed = true;
} catch (ex if ex instanceof OS.File.Error &&
(ex.winLastError == OS.Constants.Win.ERROR_ACCESS_DENIED ||
ex.winLastError == OS.Constants.Win.ERROR_SHARING_VIOLATION)) {
// Wait 100 ms before attempting to remove again.
yield wait(100);
}
} while (!removed);
});
};
} else if (MAC) {
installPath = OS.Path.join(OS.Constants.Path.homeDir, "Applications", "test_desktop_packaged_launch.app");
exePath = OS.Path.join(installPath, "Contents", "MacOS", "webapprt");
let appProfileDir = OS.Path.join(OS.Constants.Path.macUserLibDir, "Application Support",
WebappOSUtils.getUniqueName(app));
cleanup = function() {
return Task.spawn(function*() {
if (appProcess.isRunning) {
appProcess.kill();
}
if (profileDir) {
yield OS.File.removeDir(profileDir.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
yield OS.File.removeDir(appProfileDir, { ignoreAbsent: true });
});
};
}
let testAppInfo = new TestAppInfo(app);
let runTest = Task.async(function*() {
// Get to a clean state before the test
yield cleanup();
yield testAppInfo.cleanup();
SimpleTest.registerCleanupFunction(cleanup);
SimpleTest.registerCleanupFunction(() => testAppInfo.cleanup());
setDryRunPref();
@ -190,8 +79,8 @@ let runTest = Task.async(function*() {
let nativeApp = new NativeApp(app, manifest, app.categories);
ok(nativeApp, "NativeApp object created");
profileDir = nativeApp.createProfile();
ok(profileDir && profileDir.exists(), "Profile directory created");
testAppInfo.profileDir = nativeApp.createProfile();
ok(testAppInfo.profileDir && testAppInfo.profileDir.exists(), "Profile directory created");
// On Mac build servers, we don't have enough privileges to write to /Applications,
// so we install apps in a user-owned directory.
@ -223,14 +112,14 @@ let runTest = Task.async(function*() {
// accessed only if the app is actually updated (because the old manifest
// contained a different launch path).
let exeFile = getFile(exePath);
let exeFile = getFile(testAppInfo.exePath);
ok(exeFile.isExecutable(), "webapprt executable is executable");
let appClosed = false;
appProcess.init(exeFile)
appProcess.runAsync([], 0, () => appClosed = true);
testAppInfo.appProcess.init(exeFile)
testAppInfo.appProcess.runAsync([], 0, () => appClosed = true);
while (!(yield wasAppSJSAccessed()) && !appClosed) {
yield wait(1000);

View File

@ -34,10 +34,10 @@ using namespace mozilla::layers;
namespace android {
GonkNativeWindow::GonkNativeWindow() :
GonkNativeWindow::GonkNativeWindow(int bufferCount) :
GonkConsumerBase(new GonkBufferQueue(true), false)
{
mConsumer->setMaxAcquiredBufferCount(GonkBufferQueue::MIN_UNDEQUEUED_BUFFERS);
mConsumer->setMaxAcquiredBufferCount(bufferCount);
}
GonkNativeWindow::GonkNativeWindow(const sp<GonkBufferQueue>& bq,

View File

@ -67,7 +67,7 @@ class GonkNativeWindow: public GonkConsumerBase
// access at the same time.
// controlledByApp tells whether this consumer is controlled by the
// application.
GonkNativeWindow();
GonkNativeWindow(int bufferCount = GonkBufferQueue::MIN_UNDEQUEUED_BUFFERS);
GonkNativeWindow(const sp<GonkBufferQueue>& bq, uint32_t consumerUsage,
int bufferCount = GonkBufferQueue::MIN_UNDEQUEUED_BUFFERS,
bool controlledByApp = false);

View File

@ -118,6 +118,12 @@ public:
return *this;
}
nsAutoPtr<T>& operator=(nsAutoPtr<T>&& aRhs)
{
assign(aRhs.forget());
return *this;
}
// Other pointer operators
T*

View File

@ -6,6 +6,7 @@
#ifndef nsClassHashtable_h__
#define nsClassHashtable_h__
#include "mozilla/Move.h"
#include "nsBaseHashtable.h"
#include "nsHashKeys.h"
#include "nsAutoPtr.h"
@ -109,7 +110,7 @@ nsClassHashtable<KeyClass,T>::RemoveAndForget(KeyType aKey, nsAutoPtr<T> &aOut)
return;
// Transfer ownership from ent->mData into aOut.
aOut = ent->mData;
aOut = mozilla::Move(ent->mData);
this->Remove(aKey);
}