merge b2g-inbound to mozilla-central a=merge

This commit is contained in:
Carsten "Tomcat" Book 2014-10-20 12:49:01 +02:00
commit 4f2f47a353
31 changed files with 251 additions and 74 deletions

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="3a2947df41a480de1457a6dcdbf46ad0af70d8e0">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1daf2dadcd0d554c733661a4c0be1b82001e9da0"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="dc496d04907dd314f9736ff78bab3bd27156f79a"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
@ -35,7 +35,7 @@
<project name="device/sample" path="device/sample" revision="1a3d8efa0ad32ec8f145367a3cf0f54b97385c3c"/>
<project name="platform/abi/cpp" path="abi/cpp" revision="18f1b5e28734183ff8073fe86dc46bc4ebba8a59"/>
<project name="platform/bionic" path="bionic" revision="86b1f589c313422a7da1812512b9ec8d1cf9ba3c"/>
<project name="platform/bootable/recovery" path="bootable/recovery" revision="4eece0d80928a2b5266b78421ebf0c8686d4ad2c"/>
<project name="platform/bootable/recovery" path="bootable/recovery" revision="67978bf5ecdd59441296436677b3729b4142e2ff"/>
<project name="platform/external/aac" path="external/aac" revision="fa3eba16446cc8f2f5e2dfc20d86a49dbd37299e"/>
<project name="platform/external/bison" path="external/bison" revision="c2418b886165add7f5a31fc5609f0ce2d004a90e"/>
<project name="platform/external/bluetooth/bluedroid" path="external/bluetooth/bluedroid" revision="c8e99ca7e11c00f8124196fe1726a15e6e976587"/>

View File

@ -19,7 +19,7 @@
<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="1daf2dadcd0d554c733661a4c0be1b82001e9da0"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="dc496d04907dd314f9736ff78bab3bd27156f79a"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>

View File

@ -17,7 +17,7 @@
</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="1daf2dadcd0d554c733661a4c0be1b82001e9da0"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="dc496d04907dd314f9736ff78bab3bd27156f79a"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="9f6b7471c881ee689183d681658cf2ba3dfc5610"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="3a2947df41a480de1457a6dcdbf46ad0af70d8e0">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1daf2dadcd0d554c733661a4c0be1b82001e9da0"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="dc496d04907dd314f9736ff78bab3bd27156f79a"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

View File

@ -19,7 +19,7 @@
<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="1daf2dadcd0d554c733661a4c0be1b82001e9da0"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="dc496d04907dd314f9736ff78bab3bd27156f79a"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="3a2947df41a480de1457a6dcdbf46ad0af70d8e0">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1daf2dadcd0d554c733661a4c0be1b82001e9da0"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="dc496d04907dd314f9736ff78bab3bd27156f79a"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

View File

@ -17,7 +17,7 @@
</project>
<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="1daf2dadcd0d554c733661a4c0be1b82001e9da0"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="dc496d04907dd314f9736ff78bab3bd27156f79a"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="9f6b7471c881ee689183d681658cf2ba3dfc5610"/>

View File

@ -4,6 +4,6 @@
"remote": "",
"branch": ""
},
"revision": "934b8c3014a3e20dd5d90ecf95f4b6b704dddb1e",
"revision": "f486771c1a2a76bfea1a5c7eac8debe14f29927b",
"repo_path": "/integration/gaia-central"
}

View File

@ -17,7 +17,7 @@
<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="1daf2dadcd0d554c733661a4c0be1b82001e9da0"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="dc496d04907dd314f9736ff78bab3bd27156f79a"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

View File

@ -15,7 +15,7 @@
<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="1daf2dadcd0d554c733661a4c0be1b82001e9da0"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="dc496d04907dd314f9736ff78bab3bd27156f79a"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

View File

@ -17,7 +17,7 @@
</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="1daf2dadcd0d554c733661a4c0be1b82001e9da0"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="dc496d04907dd314f9736ff78bab3bd27156f79a"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="9f6b7471c881ee689183d681658cf2ba3dfc5610"/>

View File

@ -17,7 +17,7 @@
<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="1daf2dadcd0d554c733661a4c0be1b82001e9da0"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="dc496d04907dd314f9736ff78bab3bd27156f79a"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

View File

@ -386,6 +386,19 @@ public:
return NS_OK;
}
nsresult RequestData()
{
LOG(PR_LOG_DEBUG, ("Session.RequestData"));
MOZ_ASSERT(NS_IsMainThread());
if (NS_FAILED(NS_DispatchToMainThread(new PushBlobRunnable(this)))) {
MOZ_ASSERT(false, "RequestData NS_DispatchToMainThread failed");
return NS_ERROR_FAILURE;
}
return NS_OK;
}
already_AddRefed<nsIDOMBlob> GetEncodedData()
{
MOZ_ASSERT(NS_IsMainThread());
@ -816,25 +829,6 @@ MediaRecorder::Resume(ErrorResult& aResult)
mState = RecordingState::Recording;
}
class CreateAndDispatchBlobEventRunnable : public nsRunnable {
nsCOMPtr<nsIDOMBlob> mBlob;
nsRefPtr<MediaRecorder> mRecorder;
public:
CreateAndDispatchBlobEventRunnable(already_AddRefed<nsIDOMBlob>&& aBlob,
MediaRecorder* aRecorder)
: mBlob(aBlob), mRecorder(aRecorder)
{ }
NS_IMETHOD
Run();
};
NS_IMETHODIMP
CreateAndDispatchBlobEventRunnable::Run()
{
return mRecorder->CreateAndDispatchBlobEvent(mBlob.forget());
}
void
MediaRecorder::RequestData(ErrorResult& aResult)
{
@ -843,10 +837,9 @@ MediaRecorder::RequestData(ErrorResult& aResult)
return;
}
MOZ_ASSERT(mSessions.Length() > 0);
if (NS_FAILED(NS_DispatchToMainThread(
new CreateAndDispatchBlobEventRunnable(
mSessions.LastElement()->GetEncodedData(), this)))) {
MOZ_ASSERT(false, "NS_DispatchToMainThread CreateAndDispatchBlobEventRunnable failed");
nsresult rv = mSessions.LastElement()->RequestData();
if (NS_FAILED(rv)) {
NotifyError(rv);
}
}

View File

@ -42,7 +42,6 @@ class MediaRecorder : public DOMEventTargetHelper,
public nsIDocumentActivity
{
class Session;
friend class CreateAndDispatchBlobEventRunnable;
public:
MediaRecorder(DOMMediaStream& aSourceMediaStream, nsPIDOMWindow* aOwnerWindow);

View File

@ -276,6 +276,11 @@ DOMRequestIpcHelper.prototype = {
},
createRequest: function() {
// If we don't have a valid window object, throw.
if (!this._window) {
Cu.reportError("DOMRequestHelper trying to create a DOMRequest without a valid window, failing.");
throw Cr.NS_ERROR_FAILURE;
}
return Services.DOMRequest.createRequest(this._window);
},
@ -285,6 +290,11 @@ DOMRequestIpcHelper.prototype = {
* reference to window owned by this DOMRequestIPCHelper.
*/
createPromise: function(aPromiseInit) {
// If we don't have a valid window object, throw.
if (!this._window) {
Cu.reportError("DOMRequestHelper trying to create a Promise without a valid window, failing.");
throw Cr.NS_ERROR_FAILURE;
}
return new this._window.Promise(aPromiseInit);
},

View File

@ -105,7 +105,7 @@ NS_CreateMobileConnectionService()
service = new mozilla::dom::mobileconnection::MobileConnectionIPCService();
} else {
#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
service = do_CreateInstance(GONK_MOBILECONNECTION_SERVICE_CONTRACTID);
service = do_GetService(GONK_MOBILECONNECTION_SERVICE_CONTRACTID);
#endif
}

View File

@ -86,14 +86,6 @@ SettingsLock.prototype = {
_closeHelper: function() {
if (DEBUG) debug("closing lock " + this._id);
// sendMessage can get queued to run later in a thread via
// _closeHelper, but the SettingsManager may have died in between
// the time it was scheduled and the time it runs. Make sure our
// window is valid before sending, otherwise just ignore.
if (!this._settingsManager._window) {
if (DEBUG) debug("SettingsManager died, cannot send " + aMessageName + " message window principal.");
return;
}
this._open = false;
this._closeCalled = false;
if (!this._requests || Object.keys(this._requests).length == 0) {
@ -112,6 +104,18 @@ SettingsLock.prototype = {
},
sendMessage: function(aMessageName, aData) {
// sendMessage can be called after our window has died, or get
// queued to run later in a thread via _closeHelper, but the
// SettingsManager may have died in between the time it was
// scheduled and the time it runs. Make sure our window is valid
// before sending, otherwise just ignore.
if (!this._settingsManager._window) {
Cu.reportError(
"SettingsManager window died, cannot run settings transaction." +
" SettingsMessage: " + aMessageName +
" SettingsData: " + JSON.stringify(aData));
return;
}
cpmm.sendAsyncMessage(aMessageName,
aData,
undefined,

View File

@ -1972,6 +1972,9 @@ RadioInterface.prototype = {
handleUnsolicitedWorkerMessage: function(message) {
let connHandler = gDataConnectionManager.getConnectionHandler(this.clientId);
switch (message.rilMessageType) {
case "audioStateChanged":
gTelephonyService.notifyAudioStateChanged(this.clientId, message.state);
break;
case "callRing":
gTelephonyService.notifyCallRing();
break;

View File

@ -470,6 +470,11 @@ this.CELL_INFO_TYPE_CDMA = 2;
this.CELL_INFO_TYPE_LTE = 3;
this.CELL_INFO_TYPE_WCDMA = 4;
// Order matters.
this.AUDIO_STATE_NO_CALL = 0;
this.AUDIO_STATE_INCOMING = 1;
this.AUDIO_STATE_IN_CALL = 2;
this.CALL_STATE_UNKNOWN = -1;
this.CALL_STATE_ACTIVE = 0;
this.CALL_STATE_HOLDING = 1;

View File

@ -3993,6 +3993,26 @@ RilObject.prototype = {
if (conferenceChanged) {
this._ensureConference();
}
// Update audio state.
let message = {rilMessageType: "audioStateChanged",
state: this._detectAudioState()};
this.sendChromeMessage(message);
},
_detectAudioState: function() {
let callNum = Object.keys(this.currentCalls).length;
if (!callNum) {
return AUDIO_STATE_NO_CALL;
}
let firstIndex = Object.keys(this.currentCalls)[0];
if (callNum == 1 &&
this.currentCalls[firstIndex].state == CALL_STATE_INCOMING) {
return AUDIO_STATE_INCOMING;
}
return AUDIO_STATE_IN_CALL;
},
_addNewVoiceCall: function(newCall) {

View File

@ -43,9 +43,6 @@ const DIAL_ERROR_INVALID_STATE_ERROR = "InvalidStateError";
const DIAL_ERROR_OTHER_CONNECTION_IN_USE = "OtherConnectionInUse";
const DIAL_ERROR_BAD_NUMBER = RIL.GECKO_CALL_ERROR_BAD_NUMBER;
const AUDIO_STATE_NO_CALL = 0;
const AUDIO_STATE_INCOMING = 1;
const AUDIO_STATE_IN_CALL = 2;
const AUDIO_STATE_NAME = [
"PHONE_STATE_NORMAL",
"PHONE_STATE_RINGTONE",
@ -156,6 +153,7 @@ function TelephonyService() {
this._isDialing = false;
this._cachedDialRequest = null;
this._currentCalls = {};
this._audioStates = {};
this._cdmaCallWaitingNumber = null;
@ -174,6 +172,7 @@ function TelephonyService() {
for (let i = 0; i < this._numClients; ++i) {
this._enumerateCallsForClient(i);
this._isActiveCall[i] = {};
this._audioStates[i] = RIL.AUDIO_STATE_NO_CALL;
}
}
TelephonyService.prototype = {
@ -277,28 +276,19 @@ TelephonyService.prototype = {
this._numActiveCall--;
}
this._isActiveCall[aCall.clientId][aCall.callIndex] = active;
if (incoming && !this._numActiveCall) {
// Change the phone state into RINGTONE only when there's no active call.
this._updateCallAudioState(AUDIO_STATE_INCOMING);
} else if (this._numActiveCall) {
this._updateCallAudioState(AUDIO_STATE_IN_CALL);
} else {
this._updateCallAudioState(AUDIO_STATE_NO_CALL);
}
},
_updateCallAudioState: function(aAudioState) {
_updateAudioState: function(aAudioState) {
switch (aAudioState) {
case AUDIO_STATE_NO_CALL:
case RIL.AUDIO_STATE_NO_CALL:
gAudioManager.phoneState = nsIAudioManager.PHONE_STATE_NORMAL;
break;
case AUDIO_STATE_INCOMING:
case RIL.AUDIO_STATE_INCOMING:
gAudioManager.phoneState = nsIAudioManager.PHONE_STATE_RINGTONE;
break;
case AUDIO_STATE_IN_CALL:
case RIL.AUDIO_STATE_IN_CALL:
gAudioManager.phoneState = nsIAudioManager.PHONE_STATE_IN_CALL;
if (this.speakerEnabled) {
gAudioManager.setForceForUse(nsIAudioManager.USE_COMMUNICATION,
@ -309,7 +299,7 @@ TelephonyService.prototype = {
if (DEBUG) {
debug("Put audio system into " + AUDIO_STATE_NAME[aAudioState] + ": " +
gAudioManager.phoneState);
aAudioState + ", result is: " + gAudioManager.phoneState);
}
},
@ -1097,6 +1087,17 @@ TelephonyService.prototype = {
* nsIGonkTelephonyService interface.
*/
notifyAudioStateChanged: function(aClientId, aState) {
this._audioStates[aClientId] = aState;
let audioState = aState;
for (let i = 0; i < this._numClients; ++i) {
audioState = Math.max(audioState, this._audioStates[i]);
}
this._updateAudioState(audioState);
},
/**
* Handle call disconnects by updating our current state and the audio system.
*/

View File

@ -10,9 +10,11 @@
"@mozilla.org/telephony/gonktelephonyservice;1"
%}
[scriptable, uuid(79eec3c3-2dfc-4bbf-b106-af5457651ae0)]
[scriptable, uuid(068d7bf2-1773-48ef-95f8-bd835115fed7)]
interface nsIGonkTelephonyService : nsITelephonyService
{
void notifyAudioStateChanged(in unsigned long clientId, in short state);
void notifyCallDisconnected(in unsigned long clientId, in jsval call);
void notifyCallRing();

View File

@ -2,7 +2,7 @@
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Emulate Promise.jsm semantics.
Promise.defer = function() { return new Deferred(); }
Promise.defer = function() { return new Deferred(); };
function Deferred() {
this.promise = new Promise(function(resolve, reject) {
this.resolve = resolve;
@ -619,6 +619,38 @@ let emulator = (function() {
return deferred.promise;
}
/**
* Resume a call.
*
* @param call
* A TelephonyCall object.
* @return A deferred promise.
*/
function resume(call) {
log("Resuming the held call.");
let deferred = Promise.defer();
let gotResuming = false;
call.onresuming = function onresuming(event) {
log("Received 'resuming' call event");
call.onresuming = null;
checkEventCallState(event, call, "resuming");
gotResuming = true;
};
call.onconnected = function onconnected(event) {
log("Received 'connected' call event");
call.onconnected = null;
checkEventCallState(event, call, "connected");
ok(gotResuming);
deferred.resolve(call);
};
call.resume();
return deferred.promise;
}
/**
* Locally hang up a call.
*
@ -1203,6 +1235,7 @@ let emulator = (function() {
this.gAnswer = answer;
this.gHangUp = hangUp;
this.gHold = hold;
this.gResume = resume;
this.gRemoteDial = remoteDial;
this.gRemoteAnswer = remoteAnswer;
this.gRemoteHangUp = remoteHangUp;

View File

@ -83,6 +83,10 @@ startTest(function() {
.then(() => check(PHONE_STATE_IN_CALL, PHONE_STATE_IN_CALL))
.then(() => gRemoteAnswer(outCall))
.then(() => check(PHONE_STATE_IN_CALL, PHONE_STATE_IN_CALL))
.then(() => gHold(outCall))
.then(() => check(PHONE_STATE_IN_CALL, PHONE_STATE_IN_CALL))
.then(() => gResume(outCall))
.then(() => check(PHONE_STATE_IN_CALL, PHONE_STATE_IN_CALL))
// Dial out and dial in
.then(() => gRemoteDial(inNumber))
.then(call => { inCall = call; })

View File

@ -437,7 +437,8 @@ nsPermissionManager::Init()
// will end up as now()) is fine.
uint64_t modificationTime = 0;
AddInternal(principal, perm.type, perm.capability, 0, perm.expireType,
perm.expireTime, modificationTime, eNotify, eNoDBOperation);
perm.expireTime, modificationTime, eNotify, eNoDBOperation,
true /* ignoreSessionPermissions */);
}
// Stop here; we don't need the DB in the child process
@ -717,7 +718,8 @@ nsPermissionManager::AddInternal(nsIPrincipal* aPrincipal,
int64_t aExpireTime,
int64_t aModificationTime,
NotifyOperationType aNotifyOperation,
DBOperationType aDBOperation)
DBOperationType aDBOperation,
const bool aIgnoreSessionPermissions)
{
nsAutoCString host;
nsresult rv = GetHostForPrincipal(aPrincipal, host);
@ -739,6 +741,12 @@ nsPermissionManager::AddInternal(nsIPrincipal* aPrincipal,
ContentParent::GetAll(cplist);
for (uint32_t i = 0; i < cplist.Length(); ++i) {
ContentParent* cp = cplist[i];
// On platforms where we use a preallocated template process we don't
// want to notify this process about session specific permissions so
// new tabs or apps created on it won't inherit the session permissions.
if (cp->IsPreallocated() &&
aExpireType == nsIPermissionManager::EXPIRE_SESSION)
continue;
if (cp->NeedsPermissionsUpdate())
unused << cp->SendAddPermission(permission);
}
@ -824,6 +832,16 @@ nsPermissionManager::AddInternal(nsIPrincipal* aPrincipal,
id = aID;
}
// When we do the initial addition of the permissions we don't want to
// inherit session specific permissions from other tabs or apps
// so we ignore them and set the permission to PROMPT_ACTION if it was
// previously allowed or denied by the user.
if (aIgnoreSessionPermissions &&
aExpireType == nsIPermissionManager::EXPIRE_SESSION) {
aPermission = nsIPermissionManager::PROMPT_ACTION;
aExpireType = nsIPermissionManager::EXPIRE_NEVER;
}
entry->GetPermissions().AppendElement(PermissionEntry(id, typeIndex, aPermission,
aExpireType, aExpireTime,
aModificationTime));

View File

@ -155,7 +155,7 @@ public:
if (mPermissions[i].mType == aType)
return mPermissions[i];
// unknown permission... return relevant data
// unknown permission... return relevant data
return PermissionEntry(-1, aType, nsIPermissionManager::UNKNOWN_ACTION,
nsIPermissionManager::EXPIRE_NEVER, 0, 0);
}
@ -205,7 +205,8 @@ public:
int64_t aExpireTime,
int64_t aModificationTime,
NotifyOperationType aNotifyOperation,
DBOperationType aDBOperation);
DBOperationType aDBOperation,
const bool aIgnoreSessionPermissions = false);
/**
* Initialize the "webapp-uninstall" observing.

View File

@ -31,7 +31,7 @@ function run_test() {
case "TESTING:Stage2A":
// Permissions created after the child is present
do_check_eq(pm.testPermissionFromPrincipal(getPrincipalForURI("http://mozilla.org"), "cookie1"), pm.ALLOW_ACTION);
do_check_eq(pm.testPermissionFromPrincipal(getPrincipalForURI("http://mozilla.com"), "cookie2"), pm.DENY_ACTION);
do_check_eq(pm.testPermissionFromPrincipal(getPrincipalForURI("http://mozilla.com"), "cookie2"), pm.PROMPT_ACTION);
do_check_eq(pm.testPermissionFromPrincipal(getPrincipalForURI("http://mozilla.net"), "cookie3"), pm.ALLOW_ACTION);
do_check_eq(pm.testPermissionFromPrincipal(getPrincipalForURI("http://firefox.org"), "cookie1"), pm.ALLOW_ACTION);
do_check_eq(pm.testPermissionFromPrincipal(getPrincipalForURI("http://firefox.com"), "cookie2"), pm.DENY_ACTION);
@ -47,9 +47,10 @@ function run_test() {
mM.addMessageListener("TESTING:Stage2A", messageListener);
// Permissions created before the child is present
var pm = Cc["@mozilla.org/permissionmanager;1"].getService(Ci.nsIPermissionManager);
do_check_eq(pm.testPermissionFromPrincipal(getPrincipalForURI("http://mozilla.org"), "cookie1"), pm.ALLOW_ACTION);
do_check_eq(pm.testPermissionFromPrincipal(getPrincipalForURI("http://mozilla.com"), "cookie2"), pm.DENY_ACTION);
do_check_eq(pm.testPermissionFromPrincipal(getPrincipalForURI("http://mozilla.com"), "cookie2"), pm.PROMPT_ACTION);
do_check_eq(pm.testPermissionFromPrincipal(getPrincipalForURI("http://mozilla.net"), "cookie3"), pm.ALLOW_ACTION);
mM.sendAsyncMessage("TESTING:Stage2");

View File

@ -1257,7 +1257,6 @@ static const mozilla::Module::CategoryEntry kLayoutCategories[] = {
#ifdef MOZ_B2G_BT
{ "profile-after-change", "Bluetooth Service", BLUETOOTHSERVICE_CONTRACTID },
#endif
{ "profile-after-change", "MobileConnection Service", NS_MOBILE_CONNECTION_SERVICE_CONTRACTID },
{ nullptr }
};

View File

@ -44,6 +44,7 @@
#include "libdisplay/GonkDisplay.h"
#include "pixelflinger/format.h"
#include "mozilla/BasicEvents.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/layers/APZCTreeManager.h"
#include "mozilla/layers/CompositorParent.h"
#include "ParentProcessController.h"
@ -59,6 +60,7 @@
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::hal;
using namespace mozilla::gfx;
using namespace mozilla::gl;
using namespace mozilla::layers;
using namespace mozilla::widget;
@ -126,6 +128,8 @@ displayEnabledCallback(bool enabled)
nsWindow::nsWindow()
{
mFramebuffer = nullptr;
if (sScreenInitialized)
return;
@ -472,6 +476,74 @@ nsWindow::MakeFullScreen(bool aFullScreen)
return NS_OK;
}
static gralloc_module_t const*
gralloc_module()
{
hw_module_t const *module;
if (hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module)) {
return nullptr;
}
return reinterpret_cast<gralloc_module_t const*>(module);
}
static SurfaceFormat
HalFormatToSurfaceFormat(int aHalFormat, int* bytepp)
{
switch (aHalFormat) {
case HAL_PIXEL_FORMAT_RGBA_8888:
*bytepp = 4;
return SurfaceFormat::R8G8B8A8;
case HAL_PIXEL_FORMAT_RGBX_8888:
*bytepp = 4;
return SurfaceFormat::R8G8B8X8;
case HAL_PIXEL_FORMAT_BGRA_8888:
*bytepp = 4;
return SurfaceFormat::B8G8R8A8;
case HAL_PIXEL_FORMAT_RGB_565:
*bytepp = 2;
return SurfaceFormat::R5G6B5;
default:
MOZ_CRASH("Unhandled HAL pixel format");
return SurfaceFormat::UNKNOWN; // not reached
}
}
TemporaryRef<DrawTarget>
nsWindow::StartRemoteDrawing()
{
GonkDisplay* display = GetGonkDisplay();
mFramebuffer = display->DequeueBuffer();
int width = mFramebuffer->width, height = mFramebuffer->height;
void *vaddr;
if (gralloc_module()->lock(gralloc_module(), mFramebuffer->handle,
GRALLOC_USAGE_SW_READ_NEVER |
GRALLOC_USAGE_SW_WRITE_OFTEN |
GRALLOC_USAGE_HW_FB,
0, 0, width, height, &vaddr)) {
EndRemoteDrawing();
return nullptr;
}
int bytepp;
SurfaceFormat format = HalFormatToSurfaceFormat(display->surfaceformat,
&bytepp);
return mFramebufferTarget = Factory::CreateDrawTargetForData(
BackendType::CAIRO, (uint8_t*)vaddr,
IntSize(width, height), mFramebuffer->stride * bytepp, format);
}
void
nsWindow::EndRemoteDrawing()
{
if (mFramebufferTarget) {
gralloc_module()->unlock(gralloc_module(), mFramebuffer->handle);
}
if (mFramebuffer) {
GetGonkDisplay()->QueueBuffer(mFramebuffer);
}
mFramebuffer = nullptr;
mFramebufferTarget = nullptr;
}
float
nsWindow::GetDPI()
{

View File

@ -19,6 +19,7 @@
#include "nsBaseWidget.h"
#include "nsRegion.h"
#include "nsIIdleServiceInternal.h"
#include "Units.h"
extern nsIntRect gScreenBounds;
@ -31,6 +32,8 @@ class LayersManager;
}
}
class ANativeWindowBuffer;
namespace android {
class FramebufferNativeWindow;
}
@ -94,6 +97,10 @@ public:
NS_IMETHOD MakeFullScreen(bool aFullScreen) /*MOZ_OVERRIDE*/;
virtual mozilla::TemporaryRef<mozilla::gfx::DrawTarget>
StartRemoteDrawing() MOZ_OVERRIDE;
virtual void EndRemoteDrawing() MOZ_OVERRIDE;
virtual float GetDPI();
virtual double GetDefaultScaleInternal();
virtual mozilla::layers::LayerManager*
@ -118,6 +125,11 @@ protected:
bool mVisible;
InputContext mInputContext;
nsCOMPtr<nsIIdleServiceInternal> mIdleService;
// If we're using a BasicCompositor, these fields are temporarily
// set during frame composition. They wrap the hardware
// framebuffer.
mozilla::RefPtr<mozilla::gfx::DrawTarget> mFramebufferTarget;
ANativeWindowBuffer* mFramebuffer;
void BringToTop();

View File

@ -147,7 +147,7 @@ APZController::RequestContentRepaint(const FrameMetrics& aFrameMetrics)
nsCOMPtr<nsIContent> targetContent;
if (!GetDOMTargets(aFrameMetrics.GetScrollId(),
subDocument, targetContent)) {
return NS_OK;
return;
}
// If we're dealing with a sub frame or content editable element,
@ -158,7 +158,7 @@ APZController::RequestContentRepaint(const FrameMetrics& aFrameMetrics)
#endif
FrameMetrics metrics = aFrameMetrics;
mozilla::layers::APZCCallbackHelper::UpdateSubFrame(targetContent, metrics);
return NS_OK;
return;
}
#ifdef DEBUG_CONTROLLER