Merge the last green birch changeset to m-c.

This commit is contained in:
Ryan VanderMeulen 2013-04-16 16:02:42 -04:00
commit 6173eb92b6
16 changed files with 172 additions and 28 deletions

View File

@ -331,5 +331,18 @@ nsresult MediaOmxReader::GetBuffered(mozilla::dom::TimeRanges* aBuffered, int64_
return NS_OK;
}
void MediaOmxReader::OnDecodeThreadFinish() {
if (mOmxDecoder.get()) {
mOmxDecoder->Pause();
}
}
void MediaOmxReader::OnDecodeThreadStart() {
if (mOmxDecoder.get()) {
nsresult result = mOmxDecoder->Play();
NS_ASSERTION(result == NS_OK, "OmxDecoder should be in play state to continue decoding");
}
}
} // namespace mozilla

View File

@ -57,6 +57,10 @@ public:
MetadataTags** aTags);
virtual nsresult Seek(int64_t aTime, int64_t aStartTime, int64_t aEndTime, int64_t aCurrentTime);
virtual nsresult GetBuffered(mozilla::dom::TimeRanges* aBuffered, int64_t aStartTime);
virtual void OnDecodeThreadStart() MOZ_OVERRIDE;
virtual void OnDecodeThreadFinish() MOZ_OVERRIDE;
};
} // namespace mozilla

View File

@ -141,6 +141,7 @@ OmxDecoder::OmxDecoder(MediaResource *aResource,
mVideoBuffer(nullptr),
mAudioBuffer(nullptr),
mIsVideoSeeking(false),
mPaused(false),
mAudioMetadataRead(false)
{
}
@ -666,3 +667,32 @@ void OmxDecoder::ReleaseAllPendingVideoBuffersLocked()
}
mPendingVideoBuffers.clear();
}
nsresult OmxDecoder::Play() {
if (!mPaused) {
return NS_OK;
}
if (mVideoSource.get() && mVideoSource->start() != OK) {
return NS_ERROR_UNEXPECTED;
}
if (mAudioSource.get()&& mAudioSource->start() != OK) {
return NS_ERROR_UNEXPECTED;
}
mPaused = false;
return NS_OK;
}
void OmxDecoder::Pause() {
if (mPaused) {
return;
}
if (mVideoSource.get()) {
mVideoSource->pause();
}
if (mAudioSource.get()) {
mAudioSource->pause();
}
mPaused = true;
}

View File

@ -132,6 +132,10 @@ class OmxDecoder : public RefBase {
bool ToVideoFrame(VideoFrame *aFrame, int64_t aTimeUs, void *aData, size_t aSize, bool aKeyFrame);
bool ToAudioFrame(AudioFrame *aFrame, int64_t aTimeUs, void *aData, size_t aDataOffset, size_t aSize,
int32_t aAudioChannels, int32_t aAudioSampleRate);
//True if decoder is in a paused state
bool mPaused;
public:
OmxDecoder(MediaResource *aResource, AbstractMediaDecoder *aDecoder);
~OmxDecoder();
@ -172,6 +176,12 @@ public:
}
bool ReleaseVideoBuffer(MediaBuffer *aBuffer);
//Change decoder into a playing state
nsresult Play();
//Change decoder into a paused state
void Pause();
};
}

View File

@ -1,17 +1,17 @@
<!DOCTYPE html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id={674720}
https://bugzilla.mozilla.org/show_bug.cgi?id=674720
-->
<head>
<title>Test for Bug {674720} WebContacts</title>
<title>Test for Bug 674720 WebContacts</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id={674720}">Mozilla Bug {674720}</a>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=674720">Mozilla Bug 674720</a>
<p id="display"></p>
<div id="content" style="display: none">

View File

@ -1,17 +1,17 @@
<!DOCTYPE html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id={674720}
https://bugzilla.mozilla.org/show_bug.cgi?id=674720
-->
<head>
<title>Test for Bug {674720} WebContacts</title>
<title>Test for Bug 674720 WebContacts</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id={674720}">Mozilla Bug {674720}</a>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=674720">Mozilla Bug 674720</a>
<p id="display"></p>
<div id="content" style="display: none">
@ -35,6 +35,8 @@ SpecialPowers.addPermission("contacts-create", true, document);
var utils = SpecialPowers.getDOMWindowUtils(window);
function tests() {
function getView(size)
{
var buffer = new ArrayBuffer(size);
@ -130,7 +132,7 @@ function verifyBlob(blob1, blob2, isLast)
verifyBuffers(buffer1, buffer2, isLast);
}
}
var reader2 = new FileReader();
reader2.readAsArrayBuffer(blob1);
reader2.onload = function(event) {
@ -155,7 +157,6 @@ function verifyBlobArray(blobs1, blobs2)
verifyBlob(blobs1[i], blobs2[i], i == blobs1.length - 1);
}
var req;
var index = 0;
@ -314,9 +315,12 @@ function permissionTest() {
}
}
permissionTest();
}
var gContactsEnabled = SpecialPowers.getBoolPref("dom.mozContacts.enabled");
addLoadEvent(tests);
SimpleTest.waitForExplicitFinish();
addLoadEvent(permissionTest);
ok(true, "test passed");
</script>

View File

@ -52,9 +52,7 @@ let properties1 = {
email: [{type: ["work"], value: "x@y.com"}]
};
function onUnwantedSuccess() {
ok(false, "onUnwantedSuccess: shouldn't get here");
}
function tests() {
function onFailure() {
ok(false, "in on Failure!");
@ -415,9 +413,12 @@ function permissionTest() {
}
}
permissionTest();
}
let gContactsEnabled = SpecialPowers.getBoolPref("dom.mozContacts.enabled");
addLoadEvent(tests);
SimpleTest.waitForExplicitFinish();
addLoadEvent(permissionTest);
</script>
</pre>
</body>

View File

@ -1,17 +1,17 @@
<!DOCTYPE html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id={815833}
https://bugzilla.mozilla.org/show_bug.cgi?id=815833
-->
<head>
<title>Test for Bug {815833} WebContacts</title>
<title>Test for Bug 815833 WebContacts</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id={815833}">Mozilla Bug {815833}</a>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=815833">Mozilla Bug 815833</a>
<p id="display"></p>
<div id="content" style="display: none">
@ -28,7 +28,7 @@ if (!SpecialPowers.getBoolPref("dom.mozContacts.enabled")) {
comp.utils.import("resource://gre/modules/PermissionPromptHelper.jsm");
SpecialPowers.setBoolPref("dom.mozContacts.enabled", true);
}
SpecialPowers.addPermission("contacts-write", true, document);
SpecialPowers.addPermission("contacts-read", true, document);
SpecialPowers.addPermission("contacts-create", true, document);
@ -58,6 +58,8 @@ var properties2 = {
tel: [{type: ["work"], value: shortNumber, carrier: "testCarrier"}]
};
function tests() {
var req;
var index = 0;
var createResult1;
@ -254,9 +256,12 @@ function permissionTest() {
}
}
permissionTest();
}
var gContactsEnabled = SpecialPowers.getBoolPref("dom.mozContacts.enabled");
addLoadEvent(tests);
SimpleTest.waitForExplicitFinish();
addLoadEvent(permissionTest);
ok(true, "test passed");
</script>

View File

@ -294,6 +294,32 @@ TabContext::GetAppForId(uint32_t aAppId) const
return nullptr;
}
// This application caching is needed to avoid numerous unecessary application clones.
// See Bug 853632 for details.
if (aAppId == mOwnAppId) {
if (!mOwnApp) {
mOwnApp = GetAppForIdNoCache(aAppId);
}
nsCOMPtr<mozIApplication> ownApp = mOwnApp;
return ownApp.forget();
}
if (aAppId == mContainingAppId) {
if (!mContainingApp) {
mContainingApp = GetAppForIdNoCache(mContainingAppId);
}
nsCOMPtr<mozIApplication> containingApp = mContainingApp;
return containingApp.forget();
}
// We need the fallthrough here because mOwnAppId/mContainingAppId aren't always
// set before calling GetAppForId().
return GetAppForIdNoCache(aAppId);
}
already_AddRefed<mozIApplication>
TabContext::GetAppForIdNoCache(uint32_t aAppId) const
{
nsCOMPtr<nsIAppsService> appsService = do_GetService(APPS_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(appsService, nullptr);

View File

@ -159,10 +159,15 @@ protected:
private:
/**
* Translate an appId into a mozIApplication.
* Translate an appId into a mozIApplication, using lazy caching.
*/
already_AddRefed<mozIApplication> GetAppForId(uint32_t aAppId) const;
/**
* Translate an appId into a mozIApplication.
*/
already_AddRefed<mozIApplication> GetAppForIdNoCache(uint32_t aAppId) const;
/**
* Has this TabContext been initialized? If so, mutator methods will fail.
*/
@ -174,6 +179,12 @@ private:
*/
uint32_t mOwnAppId;
/**
* Cache of this TabContext's own app. If mOwnAppId is NO_APP_ID, this is
* guaranteed to be nullptr. Otherwise, it may or may not be null.
*/
mutable nsCOMPtr<mozIApplication> mOwnApp;
/**
* The id of the app which contains this TabContext's frame. If mIsBrowser,
* this corresponds to the ID of the app which contains the browser frame;
@ -182,6 +193,13 @@ private:
*/
uint32_t mContainingAppId;
/**
* Cache of the app that contains this TabContext's frame. If mContainingAppId
* is NO_APP_ID, this is guaranteed to be nullptr. Otherwise, it may or may not
* be null.
*/
mutable nsCOMPtr<mozIApplication> mContainingApp;
/**
* The requested scrolling behavior for this frame.
*/

View File

@ -159,6 +159,8 @@ XPCOMUtils.defineLazyGetter(this, "gMmsConnection", function () {
"available later.");
this.clearMmsProxySettings();
}
this.connected = gRIL.getDataCallStateByType("mms") ==
Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED;
},
/**

View File

@ -30,7 +30,6 @@ function sendSmsPduToEmulator(pdu) {
});
}
const TIMESTAMP = Date.UTC(2000, 0, 1);
function checkMessage(message, id, threadId, messageClass) {
ok(message instanceof MozSmsMessage,
"message is instanceof " + message.constructor);
@ -51,7 +50,6 @@ function checkMessage(message, id, threadId, messageClass) {
is(message.messageClass, messageClass, "message.messageClass");
ok(message.timestamp instanceof Date,
"message.timestamp is instanceof " + message.timestamp.constructor);
is(message.timestamp.getTime(), TIMESTAMP, "message.timestamp");
is(message.read, false, "message.read");
}
@ -68,6 +66,10 @@ function test_message_class_0() {
let message = event.message;
checkMessage(message, -1, 0, "class-0");
ok(event.message.timestamp.getTime() >= timeBeforeSend,
"Message's timestamp should be greater then the timetamp of sending");
ok(event.message.timestamp.getTime() <= Date.now(),
"Message's timestamp should be lesser than the timestamp of now");
// Make sure the message is not stored.
let cursor = sms.getMessages(null, false);
@ -97,7 +99,7 @@ function test_message_class_0() {
log(" Testing DCS " + dcs);
let pdu = PDU_SMSC + PDU_FIRST_OCTET + PDU_SENDER + PDU_PID_NORMAL +
dcs + PDU_TIMESTAMP + PDU_UDL + PDU_UD;
let timeBeforeSend = Date.now();
sendSmsPduToEmulator(pdu);
}
@ -112,6 +114,10 @@ function doTestMessageClassGeneric(allDCSs, messageClass, next) {
// Make sure we can correctly receive the message
checkMessage(event.message, null, null, messageClass);
ok(event.message.timestamp.getTime() >= timeBeforeSend,
"Message's timestamp should be greater then the timetamp of sending");
ok(event.message.timestamp.getTime() <= Date.now(),
"Message's timestamp should be lesser than the timestamp of now");
++dcsIndex;
if (dcsIndex >= allDCSs.length) {
@ -126,6 +132,7 @@ function doTestMessageClassGeneric(allDCSs, messageClass, next) {
let pdu = PDU_SMSC + PDU_FIRST_OCTET + PDU_SENDER + PDU_PID_NORMAL +
dcs + PDU_TIMESTAMP + PDU_UDL + PDU_UD;
let timeBeforeSend = Date.now();
sendSmsPduToEmulator(pdu);
}
@ -162,6 +169,10 @@ function test_message_class_2() {
if (pidIndex == 0) {
// Make sure we can correctly receive the message
checkMessage(event.message, null, null, "class-2");
ok(event.message.timestamp.getTime() >= timeBeforeSend,
"Message's timestamp should be greater then the timetamp of sending");
ok(event.message.timestamp.getTime() <= Date.now(),
"Message's timestamp should be lesser than the timestamp of now");
next();
return;
@ -203,7 +214,7 @@ function test_message_class_2() {
let pdu = PDU_SMSC + PDU_FIRST_OCTET + PDU_SENDER + pid + dcs +
PDU_TIMESTAMP + PDU_UDL + PDU_UD;
let timeBeforeSend = Date.now();
sendSmsPduToEmulator(pdu);
}

View File

@ -43,6 +43,8 @@ function onFailure() {
}
}
function tests() {
let mozSettings = window.navigator.mozSettings;
let req;
@ -154,9 +156,12 @@ function permissionTest() {
}
}
permissionTest();
}
let gSettingsEnabled = SpecialPowers.getBoolPref("dom.mozSettings.enabled");
addLoadEvent(tests);
SimpleTest.waitForExplicitFinish();
addLoadEvent(permissionTest);
</script>
</pre>
</body>

View File

@ -1,17 +1,17 @@
<!DOCTYPE html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id={678695}
https://bugzilla.mozilla.org/show_bug.cgi?id=678695
-->
<head>
<title>Test for Bug {678695} Settings API</title>
<title>Test for Bug 678695 Settings API</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id={678695}">Mozilla Bug {678695}</a>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=678695">Mozilla Bug 678695</a>
<p id="display"></p>
<div id="content" style="display: none">
@ -29,6 +29,8 @@ if (!SpecialPowers.getBoolPref("dom.mozSettings.enabled")) {
SpecialPowers.addPermission("settings-write", true, document);
SpecialPowers.addPermission("settings-read", true, document);
function tests() {
var screenBright = {"screen.brightness": 0.7};
function onFailure() {
@ -280,9 +282,12 @@ function permissionTest() {
}
}
permissionTest();
}
var gSettingsEnabled = SpecialPowers.getBoolPref("dom.mozSettings.enabled");
addLoadEvent(tests);
SimpleTest.waitForExplicitFinish();
addLoadEvent(permissionTest);
ok(true, "test passed");
</script>

View File

@ -1552,6 +1552,7 @@ RadioInterfaceLayer.prototype = {
message.sender = message.sender || null;
message.receiver = message.receiver || null;
message.body = message.fullBody = message.fullBody || null;
message.timestamp = Date.now();
// TODO: Bug #768441
// For now we don't store indicators persistently. When the mwi.discard

View File

@ -74,6 +74,8 @@ let RILQUIRKS_V5_LEGACY = libcutils.property_get("ro.moz.ril.v5_legacy", "true")
let RILQUIRKS_REQUEST_USE_DIAL_EMERGENCY_CALL = libcutils.property_get("ro.moz.ril.dial_emergency_call", "false") === "true";
let RILQUIRKS_MODEM_DEFAULTS_TO_EMERGENCY_MODE = libcutils.property_get("ro.moz.ril.emergency_by_default", "false") === "true";
let RILQUIRKS_SIM_APP_STATE_EXTRA_FIELDS = libcutils.property_get("ro.moz.ril.simstate_extra_field", "false") === "true";
// Needed for call-waiting on Peak device
let RILQUIRKS_EXTRA_UINT32_2ND_CALL = libcutils.property_get("ro.moz.ril.extra_int_2nd_call", "false") == "true";
// Marker object.
let PENDING_NETWORK_TYPE = {};
@ -4366,6 +4368,13 @@ RIL[REQUEST_GET_CURRENT_CALLS] = function REQUEST_GET_CURRENT_CALLS(length, opti
let calls = {};
for (let i = 0; i < calls_length; i++) {
let call = {};
// Extra uint32 field to get correct callIndex and rest of call data for
// call waiting feature.
if (RILQUIRKS_EXTRA_UINT32_2ND_CALL && i > 0) {
Buf.readUint32();
}
call.state = Buf.readUint32(); // CALL_STATE_*
call.callIndex = Buf.readUint32(); // GSM index (1-based)
call.toa = Buf.readUint32();