mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-18 15:55:36 +00:00
Merge m-c to fx-team, a=merge
This commit is contained in:
commit
bca6669470
@ -385,7 +385,7 @@ pref("urlclassifier.gethash.timeout_ms", 5000);
|
||||
pref("urlclassifier.max-complete-age", 2700);
|
||||
|
||||
// Tracking protection
|
||||
pref("privacy.trackingprotection.enabled", true);
|
||||
pref("privacy.trackingprotection.enabled", false);
|
||||
pref("privacy.trackingprotection.pbmode.enabled", false);
|
||||
|
||||
#endif
|
||||
@ -1069,6 +1069,11 @@ pref("dom.apps.customization.enabled", true);
|
||||
// New implementation to unify touch-caret and selection-carets.
|
||||
pref("layout.accessiblecaret.enabled", true);
|
||||
|
||||
// APZ on real devices supports long tap events.
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
pref("layout.accessiblecaret.use_long_tap_injector", false);
|
||||
#endif
|
||||
|
||||
// Enable sync and mozId with Firefox Accounts.
|
||||
pref("services.sync.fxaccounts.enabled", true);
|
||||
pref("identity.fxaccounts.enabled", true);
|
||||
|
@ -671,6 +671,7 @@ var settingsToObserve = {
|
||||
'mms.debugging.enabled': false,
|
||||
'network.debugging.enabled': false,
|
||||
'privacy.donottrackheader.enabled': false,
|
||||
'privacy.trackingprotection.enabled': false,
|
||||
'ril.debugging.enabled': false,
|
||||
'ril.radio.disabled': false,
|
||||
'ril.mms.requestReadReport.enabled': {
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="60cdaa3d3424db3432dc903e7f9c6c8fa099c06d"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="0019347fbaedc9d54f2f3436fff17aeb22968174"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="60cdaa3d3424db3432dc903e7f9c6c8fa099c06d"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="0019347fbaedc9d54f2f3436fff17aeb22968174"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>
|
||||
|
@ -19,11 +19,11 @@
|
||||
<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="60cdaa3d3424db3432dc903e7f9c6c8fa099c06d"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="0019347fbaedc9d54f2f3436fff17aeb22968174"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="27eb2f04e149fc2c9976d881b1b5984bbe7ee089"/>
|
||||
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="12ff7481566587aa4198cf1287598acb3a999973"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="4ace9aaee0e048dfda11bb787646c59982a3dc80"/>
|
||||
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="065f6361461030d32c6dc08d716b013bfadab1d9"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="31a7849fe9a8b743d6f5e5facc212f0ef9d57499"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="34ea6163f9f0e0122fb0bb03607eccdca31ced7a"/>
|
||||
<!-- Stock Android things -->
|
||||
|
@ -17,7 +17,7 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="60cdaa3d3424db3432dc903e7f9c6c8fa099c06d"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="0019347fbaedc9d54f2f3436fff17aeb22968174"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="31a7849fe9a8b743d6f5e5facc212f0ef9d57499"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f004530b30a63c08a16d82536858600446b2abf5"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="60cdaa3d3424db3432dc903e7f9c6c8fa099c06d"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="0019347fbaedc9d54f2f3436fff17aeb22968174"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
@ -128,10 +128,10 @@
|
||||
<!-- Emulator specific things -->
|
||||
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="72ffdf71c68a96309212eb13d63560d66db14c9e"/>
|
||||
<project name="device_generic_goldfish" path="device/generic/goldfish" remote="b2g" revision="8d4018ebd33ac3f1a043b2d54bc578028656a659"/>
|
||||
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="b2773dbc3cb24e70cff2b05522e9c959250400ac"/>
|
||||
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="6bbed5a99dd0f347bcee7fdde0463467fe3002f3"/>
|
||||
<project name="platform/external/libnfc-nci" path="external/libnfc-nci" revision="f37bd545063039e30a92f2550ae78c0e6e4e2d08"/>
|
||||
<project name="platform_external_wpa_supplicant_8" path="external/wpa_supplicant_8" remote="b2g" revision="0c6a6547cd1fd302fa2b0f6e375654df36bf0ec4"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="7132bc11fbc68acfebcd509095562ca04fad5584"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="575799df119771fcfbe9c99c8eee43f8100cd9a2"/>
|
||||
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="5f4b68c799927b6e078f987b12722c3a6ccd4a45"/>
|
||||
<project name="platform/development" path="development" revision="5968ff4e13e0d696ad8d972281fc27ae5a12829b"/>
|
||||
<project name="platform_prebuilts_qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="6a1bb59af65b6485b1090522f66fac95c3f9e22c"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="60cdaa3d3424db3432dc903e7f9c6c8fa099c06d"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="0019347fbaedc9d54f2f3436fff17aeb22968174"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -19,11 +19,11 @@
|
||||
<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="60cdaa3d3424db3432dc903e7f9c6c8fa099c06d"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="0019347fbaedc9d54f2f3436fff17aeb22968174"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="27eb2f04e149fc2c9976d881b1b5984bbe7ee089"/>
|
||||
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="12ff7481566587aa4198cf1287598acb3a999973"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="4ace9aaee0e048dfda11bb787646c59982a3dc80"/>
|
||||
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="065f6361461030d32c6dc08d716b013bfadab1d9"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="31a7849fe9a8b743d6f5e5facc212f0ef9d57499"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="34ea6163f9f0e0122fb0bb03607eccdca31ced7a"/>
|
||||
<!-- Stock Android things -->
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="60cdaa3d3424db3432dc903e7f9c6c8fa099c06d"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="0019347fbaedc9d54f2f3436fff17aeb22968174"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"git": {
|
||||
"git_revision": "60cdaa3d3424db3432dc903e7f9c6c8fa099c06d",
|
||||
"git_revision": "0019347fbaedc9d54f2f3436fff17aeb22968174",
|
||||
"remote": "https://git.mozilla.org/releases/gaia.git",
|
||||
"branch": ""
|
||||
},
|
||||
"revision": "1de2dfa13b0b91c293111198011353c7bb86242d",
|
||||
"revision": "32ae3240869f21601d31c7f71c4fd09c02239353",
|
||||
"repo_path": "integration/gaia-central"
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="60cdaa3d3424db3432dc903e7f9c6c8fa099c06d"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="0019347fbaedc9d54f2f3436fff17aeb22968174"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>
|
||||
|
@ -18,7 +18,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="60cdaa3d3424db3432dc903e7f9c6c8fa099c06d"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="0019347fbaedc9d54f2f3436fff17aeb22968174"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="31a7849fe9a8b743d6f5e5facc212f0ef9d57499"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f004530b30a63c08a16d82536858600446b2abf5"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="60cdaa3d3424db3432dc903e7f9c6c8fa099c06d"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="0019347fbaedc9d54f2f3436fff17aeb22968174"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>
|
||||
@ -141,7 +141,7 @@
|
||||
<default remote="caf" revision="refs/tags/android-5.1.0_r1" sync-j="4"/>
|
||||
<!-- Nexus 5 specific things -->
|
||||
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="fe7df1bc8dd0fd71571505d7be1c31a4ad1e40fb"/>
|
||||
<project name="device-hammerhead" path="device/lge/hammerhead" remote="b2g" revision="31b5bafd0d234984f1133a3b3d08839521f2b718"/>
|
||||
<project name="device-hammerhead" path="device/lge/hammerhead" remote="b2g" revision="844d9fe1c7114c6d586fbea611cbb7038413d762"/>
|
||||
<project name="device_lge_hammerhead-kernel" path="device/lge/hammerhead-kernel" remote="b2g" revision="8b3ffcfdd3d3852eca5488628f8bb2a08acbffa7"/>
|
||||
<project name="platform/external/libnfc-nci" path="external/libnfc-nci" revision="5d0ae53d9588c3d70c005aec9be94af9a534de16"/>
|
||||
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="c15b6e266136cd0cdd9b94d0bbed1962d9dd6672"/>
|
||||
|
@ -1268,6 +1268,7 @@ nsDocShell::LoadURI(nsIURI* aURI,
|
||||
|
||||
nsCOMPtr<nsIURI> referrer;
|
||||
nsCOMPtr<nsIURI> originalURI;
|
||||
bool loadReplace = false;
|
||||
nsCOMPtr<nsIInputStream> postStream;
|
||||
nsCOMPtr<nsIInputStream> headersStream;
|
||||
nsCOMPtr<nsISupports> owner;
|
||||
@ -1295,7 +1296,7 @@ nsDocShell::LoadURI(nsIURI* aURI,
|
||||
if (aLoadInfo) {
|
||||
aLoadInfo->GetReferrer(getter_AddRefs(referrer));
|
||||
aLoadInfo->GetOriginalURI(getter_AddRefs(originalURI));
|
||||
|
||||
aLoadInfo->GetLoadReplace(&loadReplace);
|
||||
nsDocShellInfoLoadType lt = nsIDocShellLoadInfo::loadNormal;
|
||||
aLoadInfo->GetLoadType(<);
|
||||
// Get the appropriate loadType from nsIDocShellLoadInfo type
|
||||
@ -1550,6 +1551,7 @@ nsDocShell::LoadURI(nsIURI* aURI,
|
||||
|
||||
return InternalLoad(aURI,
|
||||
originalURI,
|
||||
loadReplace,
|
||||
referrer,
|
||||
referrerPolicy,
|
||||
owner,
|
||||
@ -5215,7 +5217,8 @@ nsDocShell::LoadErrorPage(nsIURI* aURI, const char16_t* aURL,
|
||||
rv = NS_NewURI(getter_AddRefs(errorPageURI), errorPageUrl);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return InternalLoad(errorPageURI, nullptr, nullptr, mozilla::net::RP_Default,
|
||||
return InternalLoad(errorPageURI, nullptr, false, nullptr,
|
||||
mozilla::net::RP_Default,
|
||||
nullptr, INTERNAL_LOAD_FLAGS_INHERIT_OWNER, nullptr,
|
||||
nullptr, NullString(), nullptr, nullptr, LOAD_ERROR_PAGE,
|
||||
nullptr, true, NullString(), this, nullptr, nullptr,
|
||||
@ -5266,6 +5269,7 @@ nsDocShell::Reload(uint32_t aReloadFlags)
|
||||
nsAutoString contentTypeHint;
|
||||
nsCOMPtr<nsIURI> baseURI;
|
||||
nsCOMPtr<nsIURI> originalURI;
|
||||
bool loadReplace = false;
|
||||
if (doc) {
|
||||
principal = doc->NodePrincipal();
|
||||
doc->GetContentType(contentTypeHint);
|
||||
@ -5277,15 +5281,19 @@ nsDocShell::Reload(uint32_t aReloadFlags)
|
||||
}
|
||||
nsCOMPtr<nsIChannel> chan = doc->GetChannel();
|
||||
if (chan) {
|
||||
uint32_t loadFlags;
|
||||
chan->GetLoadFlags(&loadFlags);
|
||||
loadReplace = loadFlags & nsIChannel::LOAD_REPLACE;
|
||||
nsCOMPtr<nsIHttpChannel> httpChan(do_QueryInterface(chan));
|
||||
if (httpChan) {
|
||||
httpChan->GetOriginalURI(getter_AddRefs(originalURI));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rv = InternalLoad(mCurrentURI,
|
||||
originalURI,
|
||||
loadReplace,
|
||||
mReferrerURI,
|
||||
mReferrerPolicy,
|
||||
principal,
|
||||
@ -9317,7 +9325,8 @@ nsDocShell::CopyFavicon(nsIURI* aOldURI,
|
||||
class InternalLoadEvent : public nsRunnable
|
||||
{
|
||||
public:
|
||||
InternalLoadEvent(nsDocShell* aDocShell, nsIURI* aURI, nsIURI* aOriginalURI,
|
||||
InternalLoadEvent(nsDocShell* aDocShell, nsIURI* aURI,
|
||||
nsIURI* aOriginalURI, bool aLoadReplace,
|
||||
nsIURI* aReferrer, uint32_t aReferrerPolicy,
|
||||
nsISupports* aOwner, uint32_t aFlags,
|
||||
const char* aTypeHint, nsIInputStream* aPostData,
|
||||
@ -9329,6 +9338,7 @@ public:
|
||||
, mDocShell(aDocShell)
|
||||
, mURI(aURI)
|
||||
, mOriginalURI(aOriginalURI)
|
||||
, mLoadReplace(aLoadReplace)
|
||||
, mReferrer(aReferrer)
|
||||
, mReferrerPolicy(aReferrerPolicy)
|
||||
, mOwner(aOwner)
|
||||
@ -9351,6 +9361,7 @@ public:
|
||||
Run()
|
||||
{
|
||||
return mDocShell->InternalLoad(mURI, mOriginalURI,
|
||||
mLoadReplace,
|
||||
mReferrer,
|
||||
mReferrerPolicy,
|
||||
mOwner, mFlags,
|
||||
@ -9370,6 +9381,7 @@ private:
|
||||
nsRefPtr<nsDocShell> mDocShell;
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
nsCOMPtr<nsIURI> mOriginalURI;
|
||||
bool mLoadReplace;
|
||||
nsCOMPtr<nsIURI> mReferrer;
|
||||
uint32_t mReferrerPolicy;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
@ -9414,6 +9426,7 @@ nsDocShell::CreatePrincipalFromReferrer(nsIURI* aReferrer,
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::InternalLoad(nsIURI* aURI,
|
||||
nsIURI* aOriginalURI,
|
||||
bool aLoadReplace,
|
||||
nsIURI* aReferrer,
|
||||
uint32_t aReferrerPolicy,
|
||||
nsISupports* aOwner,
|
||||
@ -9676,6 +9689,7 @@ nsDocShell::InternalLoad(nsIURI* aURI,
|
||||
if (NS_SUCCEEDED(rv) && targetDocShell) {
|
||||
rv = targetDocShell->InternalLoad(aURI,
|
||||
aOriginalURI,
|
||||
aLoadReplace,
|
||||
aReferrer,
|
||||
aReferrerPolicy,
|
||||
owner,
|
||||
@ -9757,8 +9771,8 @@ nsDocShell::InternalLoad(nsIURI* aURI,
|
||||
|
||||
// Do this asynchronously
|
||||
nsCOMPtr<nsIRunnable> ev =
|
||||
new InternalLoadEvent(this, aURI, aOriginalURI, aReferrer,
|
||||
aReferrerPolicy, aOwner, aFlags,
|
||||
new InternalLoadEvent(this, aURI, aOriginalURI, aLoadReplace,
|
||||
aReferrer, aReferrerPolicy, aOwner, aFlags,
|
||||
aTypeHint, aPostData, aHeadersData,
|
||||
aLoadType, aSHEntry, aFirstParty, aSrcdoc,
|
||||
aSourceDocShell, aBaseURI);
|
||||
@ -10238,7 +10252,7 @@ nsDocShell::InternalLoad(nsIURI* aURI,
|
||||
nsINetworkPredictor::PREDICT_LOAD, this, nullptr);
|
||||
|
||||
nsCOMPtr<nsIRequest> req;
|
||||
rv = DoURILoad(aURI, aOriginalURI, aReferrer,
|
||||
rv = DoURILoad(aURI, aOriginalURI, aLoadReplace, aReferrer,
|
||||
!(aFlags & INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER),
|
||||
aReferrerPolicy,
|
||||
owner, aTypeHint, aFileName, aPostData, aHeadersData,
|
||||
@ -10313,6 +10327,7 @@ nsDocShell::GetInheritedPrincipal(bool aConsiderCurrentDocument)
|
||||
nsresult
|
||||
nsDocShell::DoURILoad(nsIURI* aURI,
|
||||
nsIURI* aOriginalURI,
|
||||
bool aLoadReplace,
|
||||
nsIURI* aReferrerURI,
|
||||
bool aSendReferrer,
|
||||
uint32_t aReferrerPolicy,
|
||||
@ -10549,6 +10564,12 @@ nsDocShell::DoURILoad(nsIURI* aURI,
|
||||
|
||||
if (aOriginalURI) {
|
||||
channel->SetOriginalURI(aOriginalURI);
|
||||
if (aLoadReplace) {
|
||||
uint32_t loadFlags;
|
||||
channel->GetLoadFlags(&loadFlags);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
channel->SetLoadFlags(loadFlags | nsIChannel::LOAD_REPLACE);
|
||||
}
|
||||
} else {
|
||||
channel->SetOriginalURI(aURI);
|
||||
}
|
||||
@ -10615,20 +10636,19 @@ nsDocShell::DoURILoad(nsIURI* aURI,
|
||||
aReferrerURI);
|
||||
}
|
||||
|
||||
//
|
||||
// If this is a HTTP channel, then set up the HTTP specific information
|
||||
// (ie. POST data, referrer, ...)
|
||||
//
|
||||
if (httpChannel) {
|
||||
nsCOMPtr<nsICacheInfoChannel> cacheChannel(do_QueryInterface(httpChannel));
|
||||
/* Get the cache Key from SH */
|
||||
nsCOMPtr<nsISupports> cacheKey;
|
||||
if (mLSHE) {
|
||||
mLSHE->GetCacheKey(getter_AddRefs(cacheKey));
|
||||
} else if (mOSHE) { // for reload cases
|
||||
mOSHE->GetCacheKey(getter_AddRefs(cacheKey));
|
||||
}
|
||||
nsCOMPtr<nsICacheInfoChannel> cacheChannel(do_QueryInterface(channel));
|
||||
nsCOMPtr<nsIUploadChannel> uploadChannel(do_QueryInterface(channel));
|
||||
|
||||
|
||||
/* Get the cache Key from SH */
|
||||
nsCOMPtr<nsISupports> cacheKey;
|
||||
if (mLSHE) {
|
||||
mLSHE->GetCacheKey(getter_AddRefs(cacheKey));
|
||||
} else if (mOSHE) { // for reload cases
|
||||
mOSHE->GetCacheKey(getter_AddRefs(cacheKey));
|
||||
}
|
||||
|
||||
if (uploadChannel) {
|
||||
// figure out if we need to set the post data stream on the channel...
|
||||
// right now, this is only done for http channels.....
|
||||
if (aPostData) {
|
||||
@ -10642,9 +10662,6 @@ nsDocShell::DoURILoad(nsIURI* aURI,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIUploadChannel> uploadChannel(do_QueryInterface(httpChannel));
|
||||
NS_ASSERTION(uploadChannel, "http must support nsIUploadChannel");
|
||||
|
||||
// we really need to have a content type associated with this stream!!
|
||||
uploadChannel->SetUploadStream(aPostData, EmptyCString(), -1);
|
||||
/* If there is a valid postdata *and* it is a History Load,
|
||||
@ -10680,6 +10697,9 @@ nsDocShell::DoURILoad(nsIURI* aURI,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (httpChannel) {
|
||||
if (aHeadersData) {
|
||||
rv = AddHeadersToChannel(aHeadersData, httpChannel);
|
||||
}
|
||||
@ -11532,6 +11552,7 @@ nsDocShell::AddState(JS::Handle<JS::Value> aData, const nsAString& aTitle,
|
||||
newSHEntry = mOSHE;
|
||||
newSHEntry->SetURI(newURI);
|
||||
newSHEntry->SetOriginalURI(newURI);
|
||||
newSHEntry->SetLoadReplace(false);
|
||||
}
|
||||
|
||||
// Step 4: Modify new/original session history entry and clear its POST
|
||||
@ -11721,6 +11742,7 @@ nsDocShell::AddToSessionHistory(nsIURI* aURI, nsIChannel* aChannel,
|
||||
// Get the post data & referrer
|
||||
nsCOMPtr<nsIInputStream> inputStream;
|
||||
nsCOMPtr<nsIURI> originalURI;
|
||||
bool loadReplace = false;
|
||||
nsCOMPtr<nsIURI> referrerURI;
|
||||
uint32_t referrerPolicy = mozilla::net::RP_Default;
|
||||
nsCOMPtr<nsISupports> cacheKey;
|
||||
@ -11749,6 +11771,9 @@ nsDocShell::AddToSessionHistory(nsIURI* aURI, nsIChannel* aChannel,
|
||||
uploadChannel->GetUploadStream(getter_AddRefs(inputStream));
|
||||
}
|
||||
httpChannel->GetOriginalURI(getter_AddRefs(originalURI));
|
||||
uint32_t loadFlags;
|
||||
aChannel->GetLoadFlags(&loadFlags);
|
||||
loadReplace = loadFlags & nsIChannel::LOAD_REPLACE;
|
||||
httpChannel->GetReferrer(getter_AddRefs(referrerURI));
|
||||
httpChannel->GetReferrerPolicy(&referrerPolicy);
|
||||
|
||||
@ -11783,6 +11808,7 @@ nsDocShell::AddToSessionHistory(nsIURI* aURI, nsIChannel* aChannel,
|
||||
mDynamicallyCreated);
|
||||
|
||||
entry->SetOriginalURI(originalURI);
|
||||
entry->SetLoadReplace(loadReplace);
|
||||
entry->SetReferrerURI(referrerURI);
|
||||
entry->SetReferrerPolicy(referrerPolicy);
|
||||
nsCOMPtr<nsIInputStreamChannel> inStrmChan = do_QueryInterface(aChannel);
|
||||
@ -11884,6 +11910,7 @@ nsDocShell::LoadHistoryEntry(nsISHEntry* aEntry, uint32_t aLoadType)
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsCOMPtr<nsIURI> originalURI;
|
||||
bool loadReplace = false;
|
||||
nsCOMPtr<nsIInputStream> postData;
|
||||
nsCOMPtr<nsIURI> referrerURI;
|
||||
uint32_t referrerPolicy;
|
||||
@ -11895,6 +11922,8 @@ nsDocShell::LoadHistoryEntry(nsISHEntry* aEntry, uint32_t aLoadType)
|
||||
NS_ENSURE_SUCCESS(aEntry->GetURI(getter_AddRefs(uri)), NS_ERROR_FAILURE);
|
||||
NS_ENSURE_SUCCESS(aEntry->GetOriginalURI(getter_AddRefs(originalURI)),
|
||||
NS_ERROR_FAILURE);
|
||||
NS_ENSURE_SUCCESS(aEntry->GetLoadReplace(&loadReplace),
|
||||
NS_ERROR_FAILURE);
|
||||
NS_ENSURE_SUCCESS(aEntry->GetReferrerURI(getter_AddRefs(referrerURI)),
|
||||
NS_ERROR_FAILURE);
|
||||
NS_ENSURE_SUCCESS(aEntry->GetReferrerPolicy(&referrerPolicy),
|
||||
@ -11976,6 +12005,7 @@ nsDocShell::LoadHistoryEntry(nsISHEntry* aEntry, uint32_t aLoadType)
|
||||
// first created. bug 947716 has been created to address this issue.
|
||||
rv = InternalLoad(uri,
|
||||
originalURI,
|
||||
loadReplace,
|
||||
referrerURI,
|
||||
referrerPolicy,
|
||||
owner,
|
||||
@ -13435,6 +13465,7 @@ nsDocShell::OnLinkClickSync(nsIContent* aContent,
|
||||
|
||||
nsresult rv = InternalLoad(clonedURI, // New URI
|
||||
nullptr, // Original URI
|
||||
false, // LoadReplace
|
||||
referer, // Referer URI
|
||||
refererPolicy, // Referer policy
|
||||
aContent->NodePrincipal(), // Owner is our node's
|
||||
|
@ -343,8 +343,10 @@ protected:
|
||||
// and the contents of aSrcdoc will be loaded instead of aURI.
|
||||
// aOriginalURI will be set as the originalURI on the channel that does the
|
||||
// load. If aOriginalURI is null, aURI will be set as the originalURI.
|
||||
// If aLoadReplace is true, OLOAD_REPLACE flag will be set to the nsIChannel.
|
||||
nsresult DoURILoad(nsIURI* aURI,
|
||||
nsIURI* aOriginalURI,
|
||||
bool aLoadReplace,
|
||||
nsIURI* aReferrer,
|
||||
bool aSendReferrer,
|
||||
uint32_t aReferrerPolicy,
|
||||
|
@ -67,6 +67,20 @@ nsDocShellLoadInfo::SetOriginalURI(nsIURI* aOriginalURI)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShellLoadInfo::GetLoadReplace(bool* aLoadReplace)
|
||||
{
|
||||
*aLoadReplace = mLoadReplace;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShellLoadInfo::SetLoadReplace(bool aLoadReplace)
|
||||
{
|
||||
mLoadReplace = aLoadReplace;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShellLoadInfo::GetOwner(nsISupports** aOwner)
|
||||
{
|
||||
|
@ -33,6 +33,7 @@ protected:
|
||||
protected:
|
||||
nsCOMPtr<nsIURI> mReferrer;
|
||||
nsCOMPtr<nsIURI> mOriginalURI;
|
||||
bool mLoadReplace;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
bool mInheritOwner;
|
||||
bool mOwnerIsExplicit;
|
||||
|
@ -46,7 +46,7 @@ interface nsITabParent;
|
||||
|
||||
typedef unsigned long nsLoadFlags;
|
||||
|
||||
[scriptable, builtinclass, uuid(df834cfd-5073-4053-96e4-4e5a4e508696)]
|
||||
[scriptable, builtinclass, uuid(539bce70-8261-462f-bbd0-40ee90b7d636)]
|
||||
interface nsIDocShell : nsIDocShellTreeItem
|
||||
{
|
||||
/**
|
||||
@ -126,6 +126,9 @@ interface nsIDocShell : nsIDocShellTreeItem
|
||||
* @param aOriginalURI - The URI to set as the originalURI on the channel
|
||||
* that does the load. If null, aURI will be set as
|
||||
* the originalURI.
|
||||
* @param aLoadReplace - If set LOAD_REPLACE flag will be set on the
|
||||
* channel. aOriginalURI is null, this argument is
|
||||
* ignored.
|
||||
* @param aReferrer - Referring URI
|
||||
* @param aReferrerPolicy - Referrer policy
|
||||
* @param aOwner - Owner (security principal)
|
||||
@ -153,6 +156,7 @@ interface nsIDocShell : nsIDocShellTreeItem
|
||||
*/
|
||||
[noscript]void internalLoad(in nsIURI aURI,
|
||||
in nsIURI aOriginalURI,
|
||||
in boolean aLoadReplace,
|
||||
in nsIURI aReferrer,
|
||||
in unsigned long aReferrerPolicy,
|
||||
in nsISupports aOwner,
|
||||
|
@ -19,7 +19,7 @@ interface nsIDocShell;
|
||||
typedef long nsDocShellInfoLoadType;
|
||||
typedef unsigned long nsDocShellInfoReferrerPolicy;
|
||||
|
||||
[scriptable, uuid(9d3bc466-5efe-414d-ae8b-3830b45877bb)]
|
||||
[scriptable, uuid(e7570e5a-f1d6-452d-b4f8-b35fdc63aa03)]
|
||||
interface nsIDocShellLoadInfo : nsISupports
|
||||
{
|
||||
/** This is the referrer for the load. */
|
||||
@ -27,9 +27,14 @@ interface nsIDocShellLoadInfo : nsISupports
|
||||
|
||||
/**
|
||||
* The originalURI to be passed to nsIDocShell.internalLoad. May be null.
|
||||
*/
|
||||
*/
|
||||
attribute nsIURI originalURI;
|
||||
|
||||
/**
|
||||
* loadReplace flag to be passed to nsIDocShell.internalLoad.
|
||||
*/
|
||||
attribute boolean loadReplace;
|
||||
|
||||
/** The owner of the load, that is, the entity responsible for
|
||||
* causing the load to occur. This should be a nsIPrincipal typically.
|
||||
*/
|
||||
|
@ -30,7 +30,7 @@ class nsSHEntryShared;
|
||||
[ptr] native nsDocShellEditorDataPtr(nsDocShellEditorData);
|
||||
[ptr] native nsSHEntryShared(nsSHEntryShared);
|
||||
|
||||
[scriptable, uuid(e45ab6ef-3485-449c-b91c-0846b2bf6faf)]
|
||||
[scriptable, uuid(3a5e5fa0-5364-4fbb-a87a-3f12a6b51903)]
|
||||
interface nsISHEntry : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -47,6 +47,11 @@ interface nsISHEntry : nsISupports
|
||||
*/
|
||||
attribute nsIURI originalURI;
|
||||
|
||||
/**
|
||||
* This flag remembers whether channel has LOAD_REPLACE set.
|
||||
*/
|
||||
attribute boolean loadReplace;
|
||||
|
||||
/**
|
||||
* A readonly property that returns the title
|
||||
* of the current entry. The object returned
|
||||
|
@ -39,6 +39,7 @@ nsSHEntry::nsSHEntry(const nsSHEntry& aOther)
|
||||
: mShared(aOther.mShared)
|
||||
, mURI(aOther.mURI)
|
||||
, mOriginalURI(aOther.mOriginalURI)
|
||||
, mLoadReplace(aOther.mLoadReplace)
|
||||
, mReferrerURI(aOther.mReferrerURI)
|
||||
, mReferrerPolicy(aOther.mReferrerPolicy)
|
||||
, mTitle(aOther.mTitle)
|
||||
@ -133,6 +134,20 @@ nsSHEntry::SetOriginalURI(nsIURI* aOriginalURI)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetLoadReplace(bool* aLoadReplace)
|
||||
{
|
||||
*aLoadReplace = mLoadReplace;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::SetLoadReplace(bool aLoadReplace)
|
||||
{
|
||||
mLoadReplace = aLoadReplace;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHEntry::GetReferrerURI(nsIURI** aReferrerURI)
|
||||
{
|
||||
|
@ -50,6 +50,7 @@ private:
|
||||
// See nsSHEntry.idl for comments on these members.
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
nsCOMPtr<nsIURI> mOriginalURI;
|
||||
bool mLoadReplace;
|
||||
nsCOMPtr<nsIURI> mReferrerURI;
|
||||
uint32_t mReferrerPolicy;
|
||||
nsString mTitle;
|
||||
|
@ -1775,6 +1775,10 @@ nsSHistory::InitiateLoad(nsISHEntry* aFrameEntry, nsIDocShell* aFrameDS,
|
||||
aFrameEntry->GetOriginalURI(getter_AddRefs(originalURI));
|
||||
loadInfo->SetOriginalURI(originalURI);
|
||||
|
||||
bool loadReplace;
|
||||
aFrameEntry->GetLoadReplace(&loadReplace);
|
||||
loadInfo->SetLoadReplace(loadReplace);
|
||||
|
||||
nsCOMPtr<nsIURI> nextURI;
|
||||
aFrameEntry->GetURI(getter_AddRefs(nextURI));
|
||||
// Time to initiate a document load
|
||||
|
@ -86,11 +86,11 @@ AvStatusToSinkString(BluetoothA2dpConnectionState aState, nsAString& aString)
|
||||
}
|
||||
}
|
||||
|
||||
class BluetoothA2dpManager::InitA2dpResultHandler final
|
||||
class BluetoothA2dpManager::InitResultHandler final
|
||||
: public BluetoothA2dpResultHandler
|
||||
{
|
||||
public:
|
||||
InitA2dpResultHandler(BluetoothProfileResultHandler* aRes)
|
||||
InitResultHandler(BluetoothProfileResultHandler* aRes)
|
||||
: mRes(aRes)
|
||||
{ }
|
||||
|
||||
@ -172,7 +172,7 @@ BluetoothA2dpManager::InitA2dpInterface(BluetoothProfileResultHandler* aRes)
|
||||
}
|
||||
|
||||
BluetoothA2dpManager* a2dpManager = BluetoothA2dpManager::Get();
|
||||
sBtA2dpInterface->Init(a2dpManager, new InitA2dpResultHandler(aRes));
|
||||
sBtA2dpInterface->Init(a2dpManager, new InitResultHandler(aRes));
|
||||
}
|
||||
|
||||
BluetoothA2dpManager::~BluetoothA2dpManager()
|
||||
@ -227,11 +227,11 @@ BluetoothA2dpManager::Get()
|
||||
return sBluetoothA2dpManager;
|
||||
}
|
||||
|
||||
class BluetoothA2dpManager::CleanupA2dpResultHandler final
|
||||
class BluetoothA2dpManager::CleanupResultHandler final
|
||||
: public BluetoothA2dpResultHandler
|
||||
{
|
||||
public:
|
||||
CleanupA2dpResultHandler(BluetoothProfileResultHandler* aRes)
|
||||
CleanupResultHandler(BluetoothProfileResultHandler* aRes)
|
||||
: mRes(aRes)
|
||||
{ }
|
||||
|
||||
@ -260,11 +260,11 @@ private:
|
||||
nsRefPtr<BluetoothProfileResultHandler> mRes;
|
||||
};
|
||||
|
||||
class BluetoothA2dpManager::CleanupA2dpResultHandlerRunnable final
|
||||
class BluetoothA2dpManager::CleanupResultHandlerRunnable final
|
||||
: public nsRunnable
|
||||
{
|
||||
public:
|
||||
CleanupA2dpResultHandlerRunnable(BluetoothProfileResultHandler* aRes)
|
||||
CleanupResultHandlerRunnable(BluetoothProfileResultHandler* aRes)
|
||||
: mRes(aRes)
|
||||
{ }
|
||||
|
||||
@ -289,11 +289,11 @@ BluetoothA2dpManager::DeinitA2dpInterface(BluetoothProfileResultHandler* aRes)
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (sBtA2dpInterface) {
|
||||
sBtA2dpInterface->Cleanup(new CleanupA2dpResultHandler(aRes));
|
||||
sBtA2dpInterface->Cleanup(new CleanupResultHandler(aRes));
|
||||
} else if (aRes) {
|
||||
// We dispatch a runnable here to make the profile resource handler
|
||||
// behave as if A2DP was initialized.
|
||||
nsRefPtr<nsRunnable> r = new CleanupA2dpResultHandlerRunnable(aRes);
|
||||
nsRefPtr<nsRunnable> r = new CleanupResultHandlerRunnable(aRes);
|
||||
if (NS_FAILED(NS_DispatchToMainThread(r))) {
|
||||
BT_LOGR("Failed to dispatch cleanup-result-handler runnable");
|
||||
}
|
||||
|
@ -47,11 +47,11 @@ protected:
|
||||
virtual ~BluetoothA2dpManager();
|
||||
|
||||
private:
|
||||
class CleanupA2dpResultHandler;
|
||||
class CleanupA2dpResultHandlerRunnable;
|
||||
class CleanupResultHandler;
|
||||
class CleanupResultHandlerRunnable;
|
||||
class ConnectResultHandler;
|
||||
class DisconnectResultHandler;
|
||||
class InitA2dpResultHandler;
|
||||
class InitResultHandler;
|
||||
class OnErrorProfileResultHandlerRunnable;
|
||||
|
||||
BluetoothA2dpManager();
|
||||
|
@ -118,11 +118,11 @@ BluetoothAvrcpManager::Reset()
|
||||
mPlayStatus = ControlPlayStatus::PLAYSTATUS_STOPPED;
|
||||
}
|
||||
|
||||
class BluetoothAvrcpManager::InitAvrcpResultHandler final
|
||||
class BluetoothAvrcpManager::InitResultHandler final
|
||||
: public BluetoothAvrcpResultHandler
|
||||
{
|
||||
public:
|
||||
InitAvrcpResultHandler(BluetoothProfileResultHandler* aRes)
|
||||
InitResultHandler(BluetoothProfileResultHandler* aRes)
|
||||
: mRes(aRes)
|
||||
{ }
|
||||
|
||||
@ -209,7 +209,7 @@ BluetoothAvrcpManager::InitAvrcpInterface(BluetoothProfileResultHandler* aRes)
|
||||
}
|
||||
|
||||
BluetoothAvrcpManager* avrcpManager = BluetoothAvrcpManager::Get();
|
||||
sBtAvrcpInterface->Init(avrcpManager, new InitAvrcpResultHandler(aRes));
|
||||
sBtAvrcpInterface->Init(avrcpManager, new InitResultHandler(aRes));
|
||||
}
|
||||
|
||||
BluetoothAvrcpManager::~BluetoothAvrcpManager()
|
||||
@ -245,11 +245,11 @@ BluetoothAvrcpManager::Get()
|
||||
return sBluetoothAvrcpManager;
|
||||
}
|
||||
|
||||
class BluetoothAvrcpManager::CleanupAvrcpResultHandler final
|
||||
class BluetoothAvrcpManager::CleanupResultHandler final
|
||||
: public BluetoothAvrcpResultHandler
|
||||
{
|
||||
public:
|
||||
CleanupAvrcpResultHandler(BluetoothProfileResultHandler* aRes)
|
||||
CleanupResultHandler(BluetoothProfileResultHandler* aRes)
|
||||
: mRes(aRes)
|
||||
{ }
|
||||
|
||||
@ -285,25 +285,19 @@ private:
|
||||
nsRefPtr<BluetoothProfileResultHandler> mRes;
|
||||
};
|
||||
|
||||
class BluetoothAvrcpManager::CleanupAvrcpResultHandlerRunnable final
|
||||
class BluetoothAvrcpManager::CleanupResultHandlerRunnable final
|
||||
: public nsRunnable
|
||||
{
|
||||
public:
|
||||
CleanupAvrcpResultHandlerRunnable(BluetoothProfileResultHandler* aRes)
|
||||
CleanupResultHandlerRunnable(BluetoothProfileResultHandler* aRes)
|
||||
: mRes(aRes)
|
||||
{ }
|
||||
{
|
||||
MOZ_ASSERT(mRes);
|
||||
}
|
||||
|
||||
NS_IMETHOD Run() override
|
||||
{
|
||||
sBtAvrcpInterface = nullptr;
|
||||
if (sBtAvrcpInterface) {
|
||||
sBtAvrcpInterface->Cleanup(new CleanupAvrcpResultHandler(mRes));
|
||||
} else if (mRes) {
|
||||
/* Not all backends support AVRCP. If it's not available
|
||||
* we signal success from here.
|
||||
*/
|
||||
mRes->Deinit();
|
||||
}
|
||||
mRes->Deinit();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -319,11 +313,11 @@ BluetoothAvrcpManager::DeinitAvrcpInterface(BluetoothProfileResultHandler* aRes)
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (sBtAvrcpInterface) {
|
||||
sBtAvrcpInterface->Cleanup(new CleanupAvrcpResultHandler(aRes));
|
||||
sBtAvrcpInterface->Cleanup(new CleanupResultHandler(aRes));
|
||||
} else if (aRes) {
|
||||
// We dispatch a runnable here to make the profile resource handler
|
||||
// behave as if A2DP was initialized.
|
||||
nsRefPtr<nsRunnable> r = new CleanupAvrcpResultHandlerRunnable(aRes);
|
||||
// behave as if AVRCP was initialized.
|
||||
nsRefPtr<nsRunnable> r = new CleanupResultHandlerRunnable(aRes);
|
||||
if (NS_FAILED(NS_DispatchToMainThread(r))) {
|
||||
BT_LOGR("Failed to dispatch cleanup-result-handler runnable");
|
||||
}
|
||||
|
@ -60,11 +60,11 @@ protected:
|
||||
virtual ~BluetoothAvrcpManager();
|
||||
|
||||
private:
|
||||
class CleanupAvrcpResultHandler;
|
||||
class CleanupAvrcpResultHandlerRunnable;
|
||||
class CleanupResultHandler;
|
||||
class CleanupResultHandlerRunnable;
|
||||
class ConnectRunnable;
|
||||
class DisconnectRunnable;
|
||||
class InitAvrcpResultHandler;
|
||||
class InitResultHandler;
|
||||
class OnErrorProfileResultHandlerRunnable;
|
||||
|
||||
BluetoothAvrcpManager();
|
||||
|
@ -170,129 +170,31 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
// Init operator class for ConnectionStateNotification
|
||||
class BluetoothDaemonA2dpModule::ConnectionStateInitOp final
|
||||
: private PDUInitOp
|
||||
{
|
||||
public:
|
||||
ConnectionStateInitOp(DaemonSocketPDU& aPDU)
|
||||
: PDUInitOp(aPDU)
|
||||
{ }
|
||||
|
||||
nsresult
|
||||
operator () (BluetoothA2dpConnectionState& aArg1,
|
||||
BluetoothAddress& aArg2) const
|
||||
{
|
||||
DaemonSocketPDU& pdu = GetPDU();
|
||||
|
||||
/* Read state */
|
||||
nsresult rv = UnpackPDU(pdu, aArg1);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Read address */
|
||||
rv = UnpackPDU(pdu, aArg2);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
WarnAboutTrailingData();
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
BluetoothDaemonA2dpModule::ConnectionStateNtf(
|
||||
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
|
||||
{
|
||||
ConnectionStateNotification::Dispatch(
|
||||
&BluetoothA2dpNotificationHandler::ConnectionStateNotification,
|
||||
ConnectionStateInitOp(aPDU));
|
||||
UnpackPDUInitOp(aPDU));
|
||||
}
|
||||
|
||||
// Init operator class for AudioStateNotification
|
||||
class BluetoothDaemonA2dpModule::AudioStateInitOp final
|
||||
: private PDUInitOp
|
||||
{
|
||||
public:
|
||||
AudioStateInitOp(DaemonSocketPDU& aPDU)
|
||||
: PDUInitOp(aPDU)
|
||||
{ }
|
||||
|
||||
nsresult
|
||||
operator () (BluetoothA2dpAudioState& aArg1,
|
||||
BluetoothAddress& aArg2) const
|
||||
{
|
||||
DaemonSocketPDU& pdu = GetPDU();
|
||||
|
||||
/* Read state */
|
||||
nsresult rv = UnpackPDU(pdu, aArg1);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Read address */
|
||||
rv = UnpackPDU(pdu, aArg2);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
WarnAboutTrailingData();
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
BluetoothDaemonA2dpModule::AudioStateNtf(
|
||||
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
|
||||
{
|
||||
AudioStateNotification::Dispatch(
|
||||
&BluetoothA2dpNotificationHandler::AudioStateNotification,
|
||||
AudioStateInitOp(aPDU));
|
||||
UnpackPDUInitOp(aPDU));
|
||||
}
|
||||
|
||||
// Init operator class for AudioConfigNotification
|
||||
class BluetoothDaemonA2dpModule::AudioConfigInitOp final
|
||||
: private PDUInitOp
|
||||
{
|
||||
public:
|
||||
AudioConfigInitOp(DaemonSocketPDU& aPDU)
|
||||
: PDUInitOp(aPDU)
|
||||
{ }
|
||||
|
||||
nsresult
|
||||
operator () (BluetoothAddress& aArg1, uint32_t aArg2, uint8_t aArg3) const
|
||||
{
|
||||
DaemonSocketPDU& pdu = GetPDU();
|
||||
|
||||
/* Read address */
|
||||
nsresult rv = UnpackPDU(pdu, aArg1);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Read sample rate */
|
||||
rv = UnpackPDU(pdu, aArg2);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Read channel count */
|
||||
rv = UnpackPDU(pdu, aArg3);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
WarnAboutTrailingData();
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
BluetoothDaemonA2dpModule::AudioConfigNtf(
|
||||
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
|
||||
{
|
||||
AudioConfigNotification::Dispatch(
|
||||
&BluetoothA2dpNotificationHandler::AudioConfigNotification,
|
||||
AudioConfigInitOp(aPDU));
|
||||
UnpackPDUInitOp(aPDU));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -110,10 +110,6 @@ protected:
|
||||
const BluetoothAddress&, uint32_t, uint8_t>
|
||||
AudioConfigNotification;
|
||||
|
||||
class ConnectionStateInitOp;
|
||||
class AudioStateInitOp;
|
||||
class AudioConfigInitOp;
|
||||
|
||||
void ConnectionStateNtf(const DaemonSocketPDUHeader& aHeader,
|
||||
DaemonSocketPDU& aPDU);
|
||||
|
||||
|
@ -738,40 +738,13 @@ BluetoothDaemonAvrcpModule::VolumeChangeNtf(
|
||||
UnpackPDUInitOp(aPDU));
|
||||
}
|
||||
|
||||
// Init operator class for PassthroughCmdNotification
|
||||
class BluetoothDaemonAvrcpModule::PassthroughCmdInitOp final
|
||||
: private PDUInitOp
|
||||
{
|
||||
public:
|
||||
PassthroughCmdInitOp(DaemonSocketPDU& aPDU)
|
||||
: PDUInitOp(aPDU)
|
||||
{ }
|
||||
|
||||
nsresult
|
||||
operator () (int& aArg1, int& aArg2) const
|
||||
{
|
||||
DaemonSocketPDU& pdu = GetPDU();
|
||||
|
||||
nsresult rv = UnpackPDU(pdu, UnpackConversion<uint8_t, int>(aArg1));
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
rv = UnpackPDU(pdu, UnpackConversion<uint8_t, int>(aArg2));
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
WarnAboutTrailingData();
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
BluetoothDaemonAvrcpModule::PassthroughCmdNtf(
|
||||
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
|
||||
{
|
||||
PassthroughCmdNotification::Dispatch(
|
||||
&BluetoothAvrcpNotificationHandler::PassthroughCmdNotification,
|
||||
PassthroughCmdInitOp(aPDU));
|
||||
UnpackPDUInitOp(aPDU));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -243,14 +243,13 @@ protected:
|
||||
VolumeChangeNotification;
|
||||
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable2<
|
||||
NotificationHandlerWrapper, void, int, int>
|
||||
NotificationHandlerWrapper, void, uint8_t, uint8_t, int, int>
|
||||
PassthroughCmdNotification;
|
||||
|
||||
class GetElementAttrInitOp;
|
||||
class GetPlayerAppAttrsTextInitOp;
|
||||
class GetPlayerAppValueInitOp;
|
||||
class GetPlayerAppValuesTextInitOp;
|
||||
class PassthroughCmdInitOp;
|
||||
class RemoteFeatureInitOp;
|
||||
|
||||
void RemoteFeatureNtf(const DaemonSocketPDUHeader& aHeader,
|
||||
|
@ -945,201 +945,40 @@ BluetoothDaemonCoreModule::DiscoveryStateChangedNtf(
|
||||
UnpackPDUInitOp(aPDU));
|
||||
}
|
||||
|
||||
// Init operator class for PinRequestNotification
|
||||
class BluetoothDaemonCoreModule::PinRequestInitOp final
|
||||
: private PDUInitOp
|
||||
{
|
||||
public:
|
||||
PinRequestInitOp(DaemonSocketPDU& aPDU)
|
||||
: PDUInitOp(aPDU)
|
||||
{ }
|
||||
|
||||
nsresult
|
||||
operator () (BluetoothAddress& aArg1, BluetoothRemoteName& aArg2,
|
||||
uint32_t& aArg3) const
|
||||
{
|
||||
DaemonSocketPDU& pdu = GetPDU();
|
||||
|
||||
/* Read remote address */
|
||||
nsresult rv = UnpackPDU(pdu, aArg1);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Read remote name */
|
||||
rv = UnpackPDU(pdu, aArg2);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Read CoD */
|
||||
rv = UnpackPDU(pdu, aArg3);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
WarnAboutTrailingData();
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
BluetoothDaemonCoreModule::PinRequestNtf(
|
||||
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
|
||||
{
|
||||
PinRequestNotification::Dispatch(
|
||||
&BluetoothNotificationHandler::PinRequestNotification,
|
||||
PinRequestInitOp(aPDU));
|
||||
UnpackPDUInitOp(aPDU));
|
||||
}
|
||||
|
||||
// Init operator class for SspRequestNotification
|
||||
class BluetoothDaemonCoreModule::SspRequestInitOp final
|
||||
: private PDUInitOp
|
||||
{
|
||||
public:
|
||||
SspRequestInitOp(DaemonSocketPDU& aPDU)
|
||||
: PDUInitOp(aPDU)
|
||||
{ }
|
||||
|
||||
nsresult
|
||||
operator () (BluetoothAddress& aArg1, BluetoothRemoteName& aArg2,
|
||||
uint32_t& aArg3, BluetoothSspVariant& aArg4,
|
||||
uint32_t& aArg5) const
|
||||
{
|
||||
DaemonSocketPDU& pdu = GetPDU();
|
||||
|
||||
/* Read remote address */
|
||||
nsresult rv = UnpackPDU(pdu, aArg1);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Read remote name */
|
||||
rv = UnpackPDU(pdu, aArg2);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Read CoD */
|
||||
rv = UnpackPDU(pdu, aArg3);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Read pairing variant */
|
||||
rv = UnpackPDU(pdu, aArg4);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Read passkey */
|
||||
rv = UnpackPDU(pdu, aArg5);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
WarnAboutTrailingData();
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
BluetoothDaemonCoreModule::SspRequestNtf(
|
||||
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
|
||||
{
|
||||
SspRequestNotification::Dispatch(
|
||||
&BluetoothNotificationHandler::SspRequestNotification,
|
||||
SspRequestInitOp(aPDU));
|
||||
UnpackPDUInitOp(aPDU));
|
||||
}
|
||||
|
||||
// Init operator class for BondStateChangedNotification
|
||||
class BluetoothDaemonCoreModule::BondStateChangedInitOp final
|
||||
: private PDUInitOp
|
||||
{
|
||||
public:
|
||||
BondStateChangedInitOp(DaemonSocketPDU& aPDU)
|
||||
: PDUInitOp(aPDU)
|
||||
{ }
|
||||
|
||||
nsresult
|
||||
operator () (BluetoothStatus& aArg1, BluetoothAddress& aArg2,
|
||||
BluetoothBondState& aArg3) const
|
||||
{
|
||||
DaemonSocketPDU& pdu = GetPDU();
|
||||
|
||||
/* Read status */
|
||||
nsresult rv = UnpackPDU(pdu, aArg1);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Read remote address */
|
||||
rv = UnpackPDU(pdu, aArg2);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Read bond state */
|
||||
rv = UnpackPDU(pdu, aArg3);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
WarnAboutTrailingData();
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
BluetoothDaemonCoreModule::BondStateChangedNtf(
|
||||
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
|
||||
{
|
||||
BondStateChangedNotification::Dispatch(
|
||||
&BluetoothNotificationHandler::BondStateChangedNotification,
|
||||
BondStateChangedInitOp(aPDU));
|
||||
UnpackPDUInitOp(aPDU));
|
||||
}
|
||||
|
||||
// Init operator class for AclStateChangedNotification
|
||||
class BluetoothDaemonCoreModule::AclStateChangedInitOp final
|
||||
: private PDUInitOp
|
||||
{
|
||||
public:
|
||||
AclStateChangedInitOp(DaemonSocketPDU& aPDU)
|
||||
: PDUInitOp(aPDU)
|
||||
{ }
|
||||
|
||||
nsresult
|
||||
operator () (BluetoothStatus& aArg1, BluetoothAddress& aArg2,
|
||||
BluetoothAclState& aArg3) const
|
||||
{
|
||||
DaemonSocketPDU& pdu = GetPDU();
|
||||
|
||||
/* Read status */
|
||||
nsresult rv = UnpackPDU(pdu, aArg1);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Read remote address */
|
||||
rv = UnpackPDU(pdu, aArg2);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Read ACL state */
|
||||
rv = UnpackPDU(pdu, aArg3);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
WarnAboutTrailingData();
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
BluetoothDaemonCoreModule::AclStateChangedNtf(
|
||||
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
|
||||
{
|
||||
AclStateChangedNotification::Dispatch(
|
||||
&BluetoothNotificationHandler::AclStateChangedNotification,
|
||||
AclStateChangedInitOp(aPDU));
|
||||
UnpackPDUInitOp(aPDU));
|
||||
}
|
||||
|
||||
// Init operator class for DutModeRecvNotification
|
||||
|
@ -298,14 +298,10 @@ private:
|
||||
NotificationHandlerWrapper, void, BluetoothStatus, uint16_t>
|
||||
LeTestModeNotification;
|
||||
|
||||
class AclStateChangedInitOp;
|
||||
class AdapterPropertiesInitOp;
|
||||
class BondStateChangedInitOp;
|
||||
class DeviceFoundInitOp;
|
||||
class DutModeRecvInitOp;
|
||||
class PinRequestInitOp;
|
||||
class RemoteDevicePropertiesInitOp;
|
||||
class SspRequestInitOp;
|
||||
|
||||
void AdapterStateChangedNtf(const DaemonSocketPDUHeader& aHeader,
|
||||
DaemonSocketPDU& aPDU);
|
||||
|
@ -1568,56 +1568,13 @@ BluetoothDaemonGattModule::ClientScanResultNtf(
|
||||
ClientScanResultInitOp(aPDU));
|
||||
}
|
||||
|
||||
// Init operator class for ClientConnect/DisconnectNotification
|
||||
class BluetoothDaemonGattModule::ClientConnectDisconnectInitOp final
|
||||
: private PDUInitOp
|
||||
{
|
||||
public:
|
||||
ClientConnectDisconnectInitOp(DaemonSocketPDU& aPDU)
|
||||
: PDUInitOp(aPDU)
|
||||
{ }
|
||||
|
||||
nsresult
|
||||
operator () (int& aArg1,
|
||||
BluetoothGattStatus& aArg2,
|
||||
int& aArg3,
|
||||
BluetoothAddress& aArg4) const
|
||||
{
|
||||
DaemonSocketPDU& pdu = GetPDU();
|
||||
|
||||
/* Read connection ID */
|
||||
nsresult rv = UnpackPDU(pdu, aArg1);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
/* Read status */
|
||||
rv = UnpackPDU(pdu, aArg2);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
/* Read client interface */
|
||||
rv = UnpackPDU(pdu, aArg3);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
/* Read address */
|
||||
rv = UnpackPDU(pdu, aArg4);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
WarnAboutTrailingData();
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
BluetoothDaemonGattModule::ClientConnectNtf(
|
||||
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
|
||||
{
|
||||
ClientConnectNotification::Dispatch(
|
||||
&BluetoothGattNotificationHandler::ConnectNotification,
|
||||
ClientConnectDisconnectInitOp(aPDU));
|
||||
UnpackPDUInitOp(aPDU));
|
||||
}
|
||||
|
||||
void
|
||||
@ -1626,7 +1583,7 @@ BluetoothDaemonGattModule::ClientDisconnectNtf(
|
||||
{
|
||||
ClientDisconnectNotification::Dispatch(
|
||||
&BluetoothGattNotificationHandler::DisconnectNotification,
|
||||
ClientConnectDisconnectInitOp(aPDU));
|
||||
UnpackPDUInitOp(aPDU));
|
||||
}
|
||||
|
||||
void
|
||||
@ -1737,56 +1694,13 @@ BluetoothDaemonGattModule::ClientExecuteWriteNtf(
|
||||
UnpackPDUInitOp(aPDU));
|
||||
}
|
||||
|
||||
// Init operator class for ClientReadRemoteRssiNotification
|
||||
class BluetoothDaemonGattModule::ClientReadRemoteRssiInitOp final
|
||||
: private PDUInitOp
|
||||
{
|
||||
public:
|
||||
ClientReadRemoteRssiInitOp(DaemonSocketPDU& aPDU)
|
||||
: PDUInitOp(aPDU)
|
||||
{ }
|
||||
|
||||
nsresult
|
||||
operator () (int& aArg1,
|
||||
BluetoothAddress& aArg2,
|
||||
int& aArg3,
|
||||
BluetoothGattStatus& aArg4) const
|
||||
{
|
||||
DaemonSocketPDU& pdu = GetPDU();
|
||||
|
||||
/* Read client interface */
|
||||
nsresult rv = UnpackPDU(pdu, aArg1);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
/* Read address */
|
||||
rv = UnpackPDU(pdu, aArg2);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
/* Read RSSI */
|
||||
rv = UnpackPDU(pdu, aArg3);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
/* Read status */
|
||||
rv = UnpackPDU(pdu, aArg4);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
WarnAboutTrailingData();
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
BluetoothDaemonGattModule::ClientReadRemoteRssiNtf(
|
||||
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
|
||||
{
|
||||
ClientReadRemoteRssiNotification::Dispatch(
|
||||
&BluetoothGattNotificationHandler::ReadRemoteRssiNotification,
|
||||
ClientReadRemoteRssiInitOp(aPDU));
|
||||
UnpackPDUInitOp(aPDU));
|
||||
}
|
||||
|
||||
void
|
||||
@ -1922,68 +1836,13 @@ BluetoothDaemonGattModule::ServerServiceDeletedNtf(
|
||||
UnpackPDUInitOp(aPDU));
|
||||
}
|
||||
|
||||
// Init operator class for ServerRequestReadNotification
|
||||
class BluetoothDaemonGattModule::ServerRequestReadInitOp final
|
||||
: private PDUInitOp
|
||||
{
|
||||
public:
|
||||
ServerRequestReadInitOp(DaemonSocketPDU& aPDU)
|
||||
: PDUInitOp(aPDU)
|
||||
{ }
|
||||
|
||||
nsresult
|
||||
operator () (int& aArg1,
|
||||
int& aArg2,
|
||||
BluetoothAddress& aArg3,
|
||||
BluetoothAttributeHandle& aArg4,
|
||||
int& aArg5,
|
||||
bool& aArg6) const
|
||||
{
|
||||
DaemonSocketPDU& pdu = GetPDU();
|
||||
|
||||
/* Read connection ID */
|
||||
nsresult rv = UnpackPDU(pdu, aArg1);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
/* Read trans ID */
|
||||
rv = UnpackPDU(pdu, aArg2);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
/* Read address */
|
||||
rv = UnpackPDU(pdu, aArg3);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
/* Read attribute handle */
|
||||
rv = UnpackPDU(pdu, aArg4);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
/* Read offset */
|
||||
rv = UnpackPDU(pdu, aArg5);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
/* Read isLong */
|
||||
rv = UnpackPDU(pdu, aArg6);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
WarnAboutTrailingData();
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
BluetoothDaemonGattModule::ServerRequestReadNtf(
|
||||
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
|
||||
{
|
||||
ServerRequestReadNotification::Dispatch(
|
||||
&BluetoothGattNotificationHandler::RequestReadNotification,
|
||||
ServerRequestReadInitOp(aPDU));
|
||||
UnpackPDUInitOp(aPDU));
|
||||
}
|
||||
|
||||
// Init operator class for ServerRequestWriteNotification
|
||||
@ -2069,56 +1928,13 @@ BluetoothDaemonGattModule::ServerRequestWriteNtf(
|
||||
ServerRequestWriteInitOp(aPDU));
|
||||
}
|
||||
|
||||
// Init operator class for ServerRequestExecuteWriteNotification
|
||||
class BluetoothDaemonGattModule::ServerRequestExecuteWriteInitOp final
|
||||
: private PDUInitOp
|
||||
{
|
||||
public:
|
||||
ServerRequestExecuteWriteInitOp(DaemonSocketPDU& aPDU)
|
||||
: PDUInitOp(aPDU)
|
||||
{ }
|
||||
|
||||
nsresult
|
||||
operator () (int& aArg1,
|
||||
int& aArg2,
|
||||
BluetoothAddress& aArg3,
|
||||
bool& aArg4) const
|
||||
{
|
||||
DaemonSocketPDU& pdu = GetPDU();
|
||||
|
||||
/* Read connection ID */
|
||||
nsresult rv = UnpackPDU(pdu, aArg1);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
/* Read trans ID */
|
||||
rv = UnpackPDU(pdu, aArg2);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
/* Read address */
|
||||
rv = UnpackPDU(pdu, aArg3);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
/* Read execute write */
|
||||
rv = UnpackPDU(pdu, aArg4);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
WarnAboutTrailingData();
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
BluetoothDaemonGattModule::ServerRequestExecuteWriteNtf(
|
||||
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
|
||||
{
|
||||
ServerRequestExecuteWriteNotification::Dispatch(
|
||||
&BluetoothGattNotificationHandler::RequestExecuteWriteNotification,
|
||||
ServerRequestExecuteWriteInitOp(aPDU));
|
||||
UnpackPDUInitOp(aPDU));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -681,14 +681,10 @@ protected:
|
||||
BluetoothGattStatus, int>
|
||||
ServerResponseConfirmationNotification;
|
||||
|
||||
class ClientScanResultInitOp;
|
||||
class ClientConnectDisconnectInitOp;
|
||||
class ClientReadRemoteRssiInitOp;
|
||||
class ClientGetDeviceTypeInitOp;
|
||||
class ClientScanResultInitOp;
|
||||
class ServerConnectionInitOp;
|
||||
class ServerRequestReadInitOp;
|
||||
class ServerRequestWriteInitOp;
|
||||
class ServerRequestExecuteWriteInitOp;
|
||||
|
||||
void ClientRegisterNtf(const DaemonSocketPDUHeader& aHeader,
|
||||
DaemonSocketPDU& aPDU);
|
||||
|
@ -777,44 +777,13 @@ BluetoothDaemonHandsfreeModule::ConnectionStateNtf(
|
||||
ConnectionStateInitOp(aPDU));
|
||||
}
|
||||
|
||||
// Init operator class for AudioStateNotification
|
||||
class BluetoothDaemonHandsfreeModule::AudioStateInitOp final
|
||||
: private PDUInitOp
|
||||
{
|
||||
public:
|
||||
AudioStateInitOp(DaemonSocketPDU& aPDU)
|
||||
: PDUInitOp(aPDU)
|
||||
{ }
|
||||
|
||||
nsresult
|
||||
operator () (BluetoothHandsfreeAudioState& aArg1,
|
||||
BluetoothAddress& aArg2) const
|
||||
{
|
||||
DaemonSocketPDU& pdu = GetPDU();
|
||||
|
||||
/* Read state */
|
||||
nsresult rv = UnpackPDU(pdu, aArg1);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Read address */
|
||||
rv = UnpackPDU(pdu, aArg2);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
WarnAboutTrailingData();
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
BluetoothDaemonHandsfreeModule::AudioStateNtf(
|
||||
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
|
||||
{
|
||||
AudioStateNotification::Dispatch(
|
||||
&BluetoothHandsfreeNotificationHandler::AudioStateNotification,
|
||||
AudioStateInitOp(aPDU));
|
||||
UnpackPDUInitOp(aPDU));
|
||||
}
|
||||
|
||||
// Init operator class for VoiceRecognitionNotification
|
||||
@ -1381,44 +1350,13 @@ BluetoothDaemonHandsfreeModule::KeyPressedNtf(
|
||||
KeyPressedInitOp(aPDU));
|
||||
}
|
||||
|
||||
// Init operator class for WbsNotification
|
||||
class BluetoothDaemonHandsfreeModule::WbsInitOp final
|
||||
: private PDUInitOp
|
||||
{
|
||||
public:
|
||||
WbsInitOp(DaemonSocketPDU& aPDU)
|
||||
: PDUInitOp(aPDU)
|
||||
{ }
|
||||
|
||||
nsresult
|
||||
operator () (BluetoothHandsfreeWbsConfig& aArg1, BluetoothAddress& aArg2) const
|
||||
{
|
||||
DaemonSocketPDU& pdu = GetPDU();
|
||||
|
||||
/* Read state */
|
||||
nsresult rv = UnpackPDU(pdu, aArg1);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Read address */
|
||||
rv = UnpackPDU(pdu, aArg2);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
WarnAboutTrailingData();
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
BluetoothDaemonHandsfreeModule::WbsNtf(
|
||||
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
|
||||
{
|
||||
WbsNotification::Dispatch(
|
||||
&BluetoothHandsfreeNotificationHandler::WbsNotification,
|
||||
WbsInitOp(aPDU));
|
||||
UnpackPDUInitOp(aPDU));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -314,7 +314,6 @@ protected:
|
||||
WbsNotification;
|
||||
|
||||
class ConnectionStateInitOp;
|
||||
class AudioStateInitOp;
|
||||
class VoiceRecognitionInitOp;
|
||||
class AnswerCallInitOp;
|
||||
class HangupCallInitOp;
|
||||
@ -330,7 +329,6 @@ protected:
|
||||
class VolumeInitOp;
|
||||
class UnknownAtInitOp;
|
||||
class KeyPressedInitOp;
|
||||
class WbsInitOp;
|
||||
|
||||
void ConnectionStateNtf(const DaemonSocketPDUHeader& aHeader,
|
||||
DaemonSocketPDU& aPDU);
|
||||
|
@ -1890,9 +1890,11 @@ BluetoothServiceBluedroid::AdapterStateChangedNotification(bool aState)
|
||||
|
||||
if (!mEnabled) {
|
||||
static void (* const sDeinitManager[])(BluetoothProfileResultHandler*) = {
|
||||
BluetoothHfpManager::DeinitHfpInterface,
|
||||
// Cleanup interfaces in opposite order to initialization.
|
||||
BluetoothGattManager::DeinitGattInterface,
|
||||
BluetoothAvrcpManager::DeinitAvrcpInterface,
|
||||
BluetoothA2dpManager::DeinitA2dpInterface,
|
||||
BluetoothGattManager::DeinitGattInterface
|
||||
BluetoothHfpManager::DeinitHfpInterface
|
||||
};
|
||||
|
||||
// Return error if BluetoothService is unavailable
|
||||
|
@ -916,6 +916,8 @@ BrowserElementChild.prototype = {
|
||||
// Pass along the position where the context menu should be located
|
||||
menuData.clientX = e.clientX;
|
||||
menuData.clientY = e.clientY;
|
||||
menuData.screenX = e.screenX;
|
||||
menuData.screenY = e.screenY;
|
||||
|
||||
// The value returned by the contextmenu sync call is true if the embedder
|
||||
// called preventDefault() on its contextmenu event.
|
||||
|
@ -648,8 +648,7 @@ WebGLTexture::EnsureInitializedImageData(TexImageTarget imageTarget,
|
||||
imageInfo.mDepth,
|
||||
bytespertexel,
|
||||
mContext->mPixelStoreUnpackAlignment);
|
||||
MOZ_ASSERT(checked_byteLength.isValid()); // Should have been checked
|
||||
// earlier.
|
||||
MOZ_RELEASE_ASSERT(checked_byteLength.isValid()); // Should have been checked earlier.
|
||||
|
||||
size_t byteCount = checked_byteLength.value();
|
||||
|
||||
|
@ -108,6 +108,12 @@ using namespace mozilla::services;
|
||||
using namespace mozilla::widget;
|
||||
using namespace mozilla::jsipc;
|
||||
|
||||
#if DEUBG
|
||||
#define LOG(args...) printf_stderr(args)
|
||||
#else
|
||||
#define LOG(...)
|
||||
#endif
|
||||
|
||||
// The flags passed by the webProgress notifications are 16 bits shifted
|
||||
// from the ones registered by webProgressListeners.
|
||||
#define NOTIFY_FLAG_SHIFT 16
|
||||
@ -437,6 +443,104 @@ TabParent::IsVisible()
|
||||
return visible;
|
||||
}
|
||||
|
||||
static void LogChannelRelevantInfo(nsIURI* aURI,
|
||||
nsIPrincipal* aLoadingPrincipal,
|
||||
nsIPrincipal* aChannelResultPrincipal,
|
||||
nsContentPolicyType aContentPolicyType) {
|
||||
nsCString loadingOrigin;
|
||||
aLoadingPrincipal->GetOrigin(loadingOrigin);
|
||||
|
||||
nsCString uriString;
|
||||
aURI->GetAsciiSpec(uriString);
|
||||
LOG("Loading %s from origin %s (type: %d)\n", uriString.get(),
|
||||
loadingOrigin.get(),
|
||||
aContentPolicyType);
|
||||
|
||||
nsCString resultPrincipalOrigin;
|
||||
aChannelResultPrincipal->GetOrigin(resultPrincipalOrigin);
|
||||
LOG("Result principal origin: %s\n", resultPrincipalOrigin.get());
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::ShouldSwitchProcess(nsIChannel* aChannel)
|
||||
{
|
||||
// If we lack of any information which is required to decide the need of
|
||||
// process switch, consider that we should switch process.
|
||||
|
||||
// Prepare the channel loading principal.
|
||||
nsCOMPtr<nsILoadInfo> loadInfo;
|
||||
aChannel->GetLoadInfo(getter_AddRefs(loadInfo));
|
||||
NS_ENSURE_TRUE(loadInfo, true);
|
||||
nsCOMPtr<nsIPrincipal> loadingPrincipal;
|
||||
loadInfo->GetLoadingPrincipal(getter_AddRefs(loadingPrincipal));
|
||||
NS_ENSURE_TRUE(loadingPrincipal, true);
|
||||
|
||||
// Prepare the channel result principal.
|
||||
nsCOMPtr<nsIPrincipal> resultPrincipal;
|
||||
nsContentUtils::GetSecurityManager()->
|
||||
GetChannelResultPrincipal(aChannel, getter_AddRefs(resultPrincipal));
|
||||
|
||||
// Log the debug info which is used to decide the need of proces switch.
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
aChannel->GetURI(getter_AddRefs(uri));
|
||||
LogChannelRelevantInfo(uri, loadingPrincipal, resultPrincipal,
|
||||
loadInfo->GetContentPolicyType());
|
||||
|
||||
// Check if the signed package is loaded from the same origin.
|
||||
bool sameOrigin = false;
|
||||
loadingPrincipal->Equals(resultPrincipal, &sameOrigin);
|
||||
if (sameOrigin) {
|
||||
LOG("Loading singed package from the same origin. Don't switch process.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
// If this is not a top level document, there's no need to switch process.
|
||||
if (nsIContentPolicy::TYPE_DOCUMENT != loadInfo->GetContentPolicyType()) {
|
||||
LOG("Subresource of a document. No need to switch process.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
// If this is a brand new process created to load the signed package
|
||||
// (triggered by previous OnStartSignedPackageRequest), the loading origin
|
||||
// will be "moz-safe-about:blank". In that case, we don't need to switch process
|
||||
// again. We compare with "moz-safe-about:blank" without appId/isBrowserElement/etc
|
||||
// taken into account. That's why we use originNoSuffix.
|
||||
nsCString loadingOriginNoSuffix;
|
||||
loadingPrincipal->GetOriginNoSuffix(loadingOriginNoSuffix);
|
||||
if (loadingOriginNoSuffix.EqualsLiteral("moz-safe-about:blank")) {
|
||||
LOG("The content is already loaded by a brand new process.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
TabParent::OnStartSignedPackageRequest(nsIChannel* aChannel)
|
||||
{
|
||||
if (!ShouldSwitchProcess(aChannel)) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
aChannel->GetURI(getter_AddRefs(uri));
|
||||
|
||||
aChannel->Cancel(NS_BINDING_FAILED);
|
||||
|
||||
nsCString uriString;
|
||||
uri->GetAsciiSpec(uriString);
|
||||
LOG("We decide to switch process. Call nsFrameLoader::SwitchProcessAndLoadURIs: %s\n",
|
||||
uriString.get());
|
||||
|
||||
nsRefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
|
||||
NS_ENSURE_TRUE_VOID(frameLoader);
|
||||
|
||||
nsresult rv = frameLoader->SwitchProcessAndLoadURI(uri);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to switch process.");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TabParent::DestroyInternal()
|
||||
{
|
||||
|
@ -442,6 +442,10 @@ public:
|
||||
int32_t& aDragAreaX, int32_t& aDragAreaY);
|
||||
layout::RenderFrameParent* GetRenderFrame();
|
||||
|
||||
// Called by HttpChannelParent. The function may use a new process to
|
||||
// reload the URI associated with the given channel.
|
||||
void OnStartSignedPackageRequest(nsIChannel* aChannel);
|
||||
|
||||
protected:
|
||||
bool ReceiveMessage(const nsString& aMessage,
|
||||
bool aSync,
|
||||
@ -482,6 +486,10 @@ protected:
|
||||
|
||||
void SetHasContentOpener(bool aHasContentOpener);
|
||||
|
||||
// Decide whether we have to use a new process to reload the URI associated
|
||||
// with the given channel.
|
||||
bool ShouldSwitchProcess(nsIChannel* aChannel);
|
||||
|
||||
ContentCacheInParent mContentCache;
|
||||
|
||||
nsIntRect mRect;
|
||||
|
@ -160,7 +160,9 @@ PEExpectedNonnegativeNP=Expected non-negative number or percentage.
|
||||
PEFilterFunctionArgumentsParsingError=Error in parsing arguments for filter function.
|
||||
PEVariableEOF=variable
|
||||
PEVariableEmpty=Expected variable value but found '%1$S'.
|
||||
PEValueWithVariablesParsingError=Error in parsing value for '%1$S' after substituting variables.
|
||||
# LOCALIZATION NOTE(PEValueWithVariablesParsingErrorInValue): %1$S is replaced
|
||||
# with the property name and %2$S is replaced with the property value.
|
||||
PEValueWithVariablesParsingErrorInValue=Error in parsing value for '%1$S' after substituting variables. Generated value was '%2$S'.
|
||||
PEValueWithVariablesFallbackInherit=Falling back to 'inherit'.
|
||||
PEValueWithVariablesFallbackInitial=Falling back to 'initial'.
|
||||
PEInvalidVariableReference=Property contained reference to invalid variable.
|
||||
|
@ -48,10 +48,6 @@ enum class MediaDecoderEventVisibility : int8_t {
|
||||
class AbstractMediaDecoder : public nsIObserver
|
||||
{
|
||||
public:
|
||||
// Returns the monitor for other threads to synchronise access to
|
||||
// state.
|
||||
virtual ReentrantMonitor& GetReentrantMonitor() = 0;
|
||||
|
||||
// A special version of the above for the ogg decoder that is allowed to be
|
||||
// called cross-thread.
|
||||
virtual bool IsOggDecoderShutdown() { return false; }
|
||||
|
@ -26,8 +26,9 @@ PRLogModuleInfo* gMP3DemuxerLog;
|
||||
#define MP3DEMUXER_LOGV(msg, ...)
|
||||
#endif
|
||||
|
||||
using media::TimeUnit;
|
||||
using media::TimeIntervals;
|
||||
using mozilla::media::TimeUnit;
|
||||
using mozilla::media::TimeIntervals;
|
||||
using mp4_demuxer::ByteReader;
|
||||
|
||||
namespace mozilla {
|
||||
namespace mp3 {
|
||||
@ -374,45 +375,50 @@ MP3TrackDemuxer::FindNextFrame() {
|
||||
|
||||
uint8_t buffer[BUFFER_SIZE];
|
||||
int32_t read = 0;
|
||||
const uint8_t* frameBeg = nullptr;
|
||||
const uint8_t* bufferEnd = nullptr;
|
||||
|
||||
while (frameBeg == bufferEnd) {
|
||||
bool foundFrame = false;
|
||||
int64_t frameHeaderOffset = 0;
|
||||
|
||||
// Check whether we've found a valid MPEG frame.
|
||||
while (!foundFrame) {
|
||||
if ((!mParser.FirstFrame().Length() &&
|
||||
mOffset - mParser.ID3Header().Size() > MAX_SKIPPED_BYTES) ||
|
||||
(read = Read(buffer, mOffset, BUFFER_SIZE)) == 0) {
|
||||
// This is not a valid MPEG audio stream or we've reached EOS, give up.
|
||||
break;
|
||||
}
|
||||
NS_ENSURE_TRUE(mOffset + read > mOffset, MediaByteRange(0, 0));
|
||||
mOffset += read;
|
||||
bufferEnd = buffer + read;
|
||||
const FrameParserResult parseResults = mParser.Parse(buffer, bufferEnd);
|
||||
frameBeg = parseResults.mBufferPos;
|
||||
|
||||
// If mBytesToSkip is > 0, this skips the rest of an ID3 tag which stretches
|
||||
// beyond the current buffer.
|
||||
NS_ENSURE_TRUE(mOffset + parseResults.mBytesToSkip >= mOffset, MediaByteRange(0, 0));
|
||||
mOffset += parseResults.mBytesToSkip;
|
||||
ByteReader reader(buffer, read);
|
||||
uint32_t bytesToSkip = 0;
|
||||
foundFrame = mParser.Parse(&reader, &bytesToSkip);
|
||||
frameHeaderOffset = mOffset + reader.Offset() - FrameParser::FrameHeader::SIZE;
|
||||
|
||||
// If we've found neither an MPEG frame header nor an ID3v2 tag,
|
||||
// the reader shouldn't have any bytes remaining.
|
||||
MOZ_ASSERT(foundFrame || bytesToSkip || !reader.Remaining());
|
||||
reader.DiscardRemaining();
|
||||
|
||||
// Advance mOffset by the amount of bytes read and if necessary,
|
||||
// skip an ID3v2 tag which stretches beyond the current buffer.
|
||||
NS_ENSURE_TRUE(mOffset + read + bytesToSkip > mOffset, MediaByteRange(0, 0));
|
||||
mOffset += read + bytesToSkip;
|
||||
}
|
||||
|
||||
if (frameBeg == bufferEnd || !mParser.CurrentFrame().Length()) {
|
||||
MP3DEMUXER_LOG("FindNext() Exit frameBeg=%p bufferEnd=%p "
|
||||
"mParser.CurrentFrame().Length()=%d ",
|
||||
frameBeg, bufferEnd, mParser.CurrentFrame().Length());
|
||||
if (!foundFrame || !mParser.CurrentFrame().Length()) {
|
||||
MP3DEMUXER_LOG("FindNext() Exit foundFrame=%d mParser.CurrentFrame().Length()=%d ",
|
||||
foundFrame, mParser.CurrentFrame().Length());
|
||||
return { 0, 0 };
|
||||
}
|
||||
|
||||
MP3DEMUXER_LOGV("FindNext() End mOffset=%" PRIu64 " mNumParsedFrames=%" PRIu64
|
||||
" mFrameIndex=%" PRId64 " bufferEnd=%p frameBeg=%p"
|
||||
" mFrameIndex=%" PRId64 " frameHeaderOffset=%d"
|
||||
" mTotalFrameLen=%" PRIu64 " mSamplesPerFrame=%d mSamplesPerSecond=%d "
|
||||
"mChannels=%d",
|
||||
mOffset, mNumParsedFrames, mFrameIndex, bufferEnd, frameBeg,
|
||||
mOffset, mNumParsedFrames, mFrameIndex, frameHeaderOffset,
|
||||
mTotalFrameLen, mSamplesPerFrame,
|
||||
mSamplesPerSecond, mChannels);
|
||||
|
||||
const int64_t nextBeg = mOffset - (bufferEnd - frameBeg) + 1;
|
||||
return { nextBeg, nextBeg + mParser.CurrentFrame().Length() };
|
||||
return { frameHeaderOffset, frameHeaderOffset + mParser.CurrentFrame().Length() };
|
||||
}
|
||||
|
||||
bool
|
||||
@ -470,7 +476,9 @@ MP3TrackDemuxer::GetNextFrame(const MediaByteRange& aRange) {
|
||||
if (mNumParsedFrames == 1) {
|
||||
// First frame parsed, let's read VBR info if available.
|
||||
// TODO: read info that helps with seeking (bug 1163667).
|
||||
mParser.ParseVBRHeader(frame->Data(), frame->Data() + frame->Size());
|
||||
ByteReader reader(frame->Data(), frame->Size());
|
||||
mParser.ParseVBRHeader(&reader);
|
||||
reader.DiscardRemaining();
|
||||
mFirstFrameOffset = frame->mOffset;
|
||||
}
|
||||
|
||||
@ -594,49 +602,49 @@ FrameParser::VBRInfo() const {
|
||||
return mVBRHeader;
|
||||
}
|
||||
|
||||
FrameParserResult
|
||||
FrameParser::Parse(const uint8_t* aBeg, const uint8_t* aEnd) {
|
||||
if (!aBeg || !aEnd || aBeg >= aEnd) {
|
||||
return { aEnd, 0 };
|
||||
}
|
||||
bool
|
||||
FrameParser::Parse(ByteReader* aReader, uint32_t* aBytesToSkip) {
|
||||
MOZ_ASSERT(aReader && aBytesToSkip);
|
||||
*aBytesToSkip = 0;
|
||||
|
||||
if (!mID3Parser.Header().Size() && !mFirstFrame.Length()) {
|
||||
// No MP3 frames have been parsed yet, look for ID3v2 headers at file begin.
|
||||
// ID3v1 tags may only be at file end.
|
||||
// TODO: should we try to read ID3 tags at end of file/mid-stream, too?
|
||||
const uint8_t* id3Beg = mID3Parser.Parse(aBeg, aEnd);
|
||||
if (id3Beg != aEnd) {
|
||||
const size_t prevReaderOffset = aReader->Offset();
|
||||
const uint32_t tagSize = mID3Parser.Parse(aReader);
|
||||
if (tagSize) {
|
||||
// ID3 tag found, skip past it.
|
||||
const uint32_t tagSize = ID3Parser::ID3Header::SIZE + mID3Parser.Header().Size() +
|
||||
mID3Parser.Header().FooterSize();
|
||||
const uint32_t remainingBuffer = aEnd - id3Beg;
|
||||
if (tagSize > remainingBuffer) {
|
||||
// Skipping across the ID3 tag would take us past the end of the buffer, therefore we
|
||||
const uint32_t skipSize = tagSize - ID3Parser::ID3Header::SIZE;
|
||||
|
||||
if (skipSize > aReader->Remaining()) {
|
||||
// Skipping across the ID3v2 tag would take us past the end of the buffer, therefore we
|
||||
// return immediately and let the calling function handle skipping the rest of the tag.
|
||||
MP3DEMUXER_LOGV("ID3v2 tag detected, size=%d, "
|
||||
"needing to skip %d bytes past the current buffer",
|
||||
tagSize, tagSize - remainingBuffer);
|
||||
return { aEnd, tagSize - remainingBuffer };
|
||||
tagSize, skipSize - aReader->Remaining());
|
||||
*aBytesToSkip = skipSize - aReader->Remaining();
|
||||
return false;
|
||||
}
|
||||
MP3DEMUXER_LOGV("ID3v2 tag detected, size=%d", tagSize);
|
||||
aBeg = id3Beg + tagSize;
|
||||
aReader->Read(skipSize);
|
||||
} else {
|
||||
// No ID3v2 tag found, rewinding reader in order to search for a MPEG frame header.
|
||||
aReader->Seek(prevReaderOffset);
|
||||
}
|
||||
}
|
||||
|
||||
while (aBeg < aEnd && !mFrame.ParseNext(*aBeg)) {
|
||||
++aBeg;
|
||||
}
|
||||
while (aReader->CanRead8() && !mFrame.ParseNext(aReader->ReadU8())) { }
|
||||
|
||||
if (mFrame.Length()) {
|
||||
// MP3 frame found.
|
||||
if (!mFirstFrame.Length()) {
|
||||
mFirstFrame = mFrame;
|
||||
}
|
||||
// Move to the frame header begin to allow for whole-frame parsing.
|
||||
aBeg -= FrameHeader::SIZE;
|
||||
return { aBeg, 0 };
|
||||
// Indicate success.
|
||||
return true;
|
||||
}
|
||||
return { aEnd, 0 };
|
||||
return false;
|
||||
}
|
||||
|
||||
// FrameParser::Header
|
||||
@ -846,9 +854,11 @@ FrameParser::VBRHeader::NumFrames() const {
|
||||
}
|
||||
|
||||
bool
|
||||
FrameParser::VBRHeader::ParseXing(const uint8_t* aBeg, const uint8_t* aEnd) {
|
||||
FrameParser::VBRHeader::ParseXing(ByteReader* aReader) {
|
||||
static const uint32_t TAG = BigEndian::readUint32("Xing");
|
||||
static const uint32_t TAG2 = BigEndian::readUint32("Info");
|
||||
static const uint32_t FRAME_COUNT_OFFSET = 8;
|
||||
static const uint32_t FRAME_COUNT_SIZE = 4;
|
||||
|
||||
enum Flags {
|
||||
NUM_FRAMES = 0x01,
|
||||
@ -857,51 +867,61 @@ FrameParser::VBRHeader::ParseXing(const uint8_t* aBeg, const uint8_t* aEnd) {
|
||||
VBR_SCALE = 0x08
|
||||
};
|
||||
|
||||
if (!aBeg || !aEnd || aBeg >= aEnd) {
|
||||
return false;
|
||||
}
|
||||
MOZ_ASSERT(aReader);
|
||||
const size_t prevReaderOffset = aReader->Offset();
|
||||
|
||||
// We have to search for the Xing header as its position can change.
|
||||
for (; aBeg + sizeof(TAG) < aEnd; ++aBeg) {
|
||||
if (BigEndian::readUint32(aBeg) != TAG) {
|
||||
while (aReader->Remaining() >= FRAME_COUNT_OFFSET + FRAME_COUNT_SIZE) {
|
||||
if (aReader->PeekU32() != TAG && aReader->PeekU32() != TAG2) {
|
||||
aReader->Read(1);
|
||||
continue;
|
||||
}
|
||||
// Skip across the VBR header ID tag.
|
||||
aReader->Read(sizeof(TAG));
|
||||
|
||||
const uint32_t flags = BigEndian::readUint32(aBeg + sizeof(TAG));
|
||||
if (flags & NUM_FRAMES && aBeg + FRAME_COUNT_OFFSET < aEnd) {
|
||||
mNumFrames = BigEndian::readUint32(aBeg + FRAME_COUNT_OFFSET);
|
||||
const uint32_t flags = aReader->ReadU32();
|
||||
if (flags & NUM_FRAMES) {
|
||||
mNumFrames = aReader->ReadU32();
|
||||
}
|
||||
mType = XING;
|
||||
aReader->Seek(prevReaderOffset);
|
||||
return true;
|
||||
}
|
||||
aReader->Seek(prevReaderOffset);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
FrameParser::VBRHeader::ParseVBRI(const uint8_t* aBeg, const uint8_t* aEnd) {
|
||||
FrameParser::VBRHeader::ParseVBRI(ByteReader* aReader) {
|
||||
static const uint32_t TAG = BigEndian::readUint32("VBRI");
|
||||
static const uint32_t OFFSET = 32 - FrameParser::FrameHeader::SIZE;
|
||||
static const uint32_t OFFSET = 32 + FrameParser::FrameHeader::SIZE;
|
||||
static const uint32_t FRAME_COUNT_OFFSET = OFFSET + 14;
|
||||
static const uint32_t MIN_FRAME_SIZE = OFFSET + 26;
|
||||
|
||||
if (!aBeg || !aEnd || aBeg >= aEnd) {
|
||||
return false;
|
||||
}
|
||||
MOZ_ASSERT(aReader);
|
||||
// ParseVBRI assumes that the ByteReader offset points to the beginning of a frame,
|
||||
// therefore as a simple check, we look for the presence of a frame sync at that position.
|
||||
MOZ_ASSERT(aReader->PeekU16() & 0xFFE0);
|
||||
const size_t prevReaderOffset = aReader->Offset();
|
||||
|
||||
const int64_t frameLen = aEnd - aBeg;
|
||||
// VBRI have a fixed relative position, so let's check for it there.
|
||||
if (frameLen > MIN_FRAME_SIZE &&
|
||||
BigEndian::readUint32(aBeg + OFFSET) == TAG) {
|
||||
mNumFrames = BigEndian::readUint32(aBeg + FRAME_COUNT_OFFSET);
|
||||
mType = VBRI;
|
||||
return true;
|
||||
if (aReader->Remaining() > MIN_FRAME_SIZE) {
|
||||
aReader->Seek(prevReaderOffset + OFFSET);
|
||||
if (aReader->ReadU32() == TAG) {
|
||||
aReader->Seek(prevReaderOffset + FRAME_COUNT_OFFSET);
|
||||
mNumFrames = aReader->ReadU32();
|
||||
mType = VBRI;
|
||||
aReader->Seek(prevReaderOffset);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
aReader->Seek(prevReaderOffset);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
FrameParser::VBRHeader::Parse(const uint8_t* aBeg, const uint8_t* aEnd) {
|
||||
return ParseVBRI(aBeg, aEnd) || ParseXing(aBeg, aEnd);
|
||||
FrameParser::VBRHeader::Parse(ByteReader* aReader) {
|
||||
return ParseVBRI(aReader) || ParseXing(aReader);
|
||||
}
|
||||
|
||||
// FrameParser::Frame
|
||||
@ -935,8 +955,8 @@ FrameParser::Frame::Header() const {
|
||||
}
|
||||
|
||||
bool
|
||||
FrameParser::ParseVBRHeader(const uint8_t* aBeg, const uint8_t* aEnd) {
|
||||
return mVBRHeader.Parse(aBeg, aEnd);
|
||||
FrameParser::ParseVBRHeader(ByteReader* aReader) {
|
||||
return mVBRHeader.Parse(aReader);
|
||||
}
|
||||
|
||||
// ID3Parser
|
||||
@ -959,21 +979,17 @@ static const uint8_t MIN_MAJOR_VER = 2;
|
||||
static const uint8_t MAX_MAJOR_VER = 4;
|
||||
} // namespace id3_header
|
||||
|
||||
const uint8_t*
|
||||
ID3Parser::Parse(const uint8_t* aBeg, const uint8_t* aEnd) {
|
||||
if (!aBeg || !aEnd || aBeg >= aEnd) {
|
||||
return aEnd;
|
||||
}
|
||||
uint32_t
|
||||
ID3Parser::Parse(ByteReader* aReader) {
|
||||
MOZ_ASSERT(aReader);
|
||||
|
||||
while (aBeg < aEnd && !mHeader.ParseNext(*aBeg)) {
|
||||
++aBeg;
|
||||
}
|
||||
while (aReader->CanRead8() && !mHeader.ParseNext(aReader->ReadU8())) { }
|
||||
|
||||
if (aBeg < aEnd) {
|
||||
// Header found, move to header begin.
|
||||
aBeg -= ID3Header::SIZE - 1;
|
||||
if (mHeader.IsValid()) {
|
||||
// Header found, return total tag size.
|
||||
return ID3Header::SIZE + Header().Size() + Header().FooterSize();
|
||||
}
|
||||
return aBeg;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "MediaDataDemuxer.h"
|
||||
#include "MediaResource.h"
|
||||
#include "mp4_demuxer/ByteReader.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace mp3 {
|
||||
@ -103,9 +104,9 @@ public:
|
||||
// Returns the parsed ID3 header. Note: check for validity.
|
||||
const ID3Header& Header() const;
|
||||
|
||||
// Parses the given buffer range [aBeg, aEnd) for a valid ID3 header.
|
||||
// Returns the header begin position or aEnd if no valid header was found.
|
||||
const uint8_t* Parse(const uint8_t* aBeg, const uint8_t* aEnd);
|
||||
// Parses contents of given ByteReader for a valid ID3v2 header.
|
||||
// Returns the total ID3v2 tag size if successful and zero otherwise.
|
||||
uint32_t Parse(mp4_demuxer::ByteReader* aReader);
|
||||
|
||||
// Resets the state to allow for a new parsing session.
|
||||
void Reset();
|
||||
@ -115,11 +116,6 @@ private:
|
||||
ID3Header mHeader;
|
||||
};
|
||||
|
||||
struct FrameParserResult {
|
||||
const uint8_t* mBufferPos;
|
||||
const uint32_t mBytesToSkip;
|
||||
};
|
||||
|
||||
// MPEG audio frame parser.
|
||||
// The MPEG frame header has the following format (one bit per character):
|
||||
// 11111111 111VVLLC BBBBSSPR MMEETOHH
|
||||
@ -224,18 +220,24 @@ public:
|
||||
// Returns the total number of frames expected in the stream/file.
|
||||
int64_t NumFrames() const;
|
||||
|
||||
// Parses given buffer [aBeg, aEnd) for a valid VBR header.
|
||||
// Parses contents of given ByteReader for a valid VBR header.
|
||||
// The offset of the passed ByteReader needs to point to an MPEG frame begin,
|
||||
// as a VBRI-style header is searched at a fixed offset relative to frame begin.
|
||||
// Returns whether a valid VBR header was found in the range.
|
||||
bool Parse(const uint8_t* aBeg, const uint8_t* aEnd);
|
||||
bool Parse(mp4_demuxer::ByteReader* aReader);
|
||||
|
||||
private:
|
||||
// Parses given buffer [aBeg, aEnd) for a valid Xing header.
|
||||
// Parses contents of given ByteReader for a valid Xing header.
|
||||
// The initial ByteReader offset will be preserved.
|
||||
// Returns whether a valid Xing header was found in the range.
|
||||
bool ParseXing(const uint8_t* aBeg, const uint8_t* aEnd);
|
||||
bool ParseXing(mp4_demuxer::ByteReader* aReader);
|
||||
|
||||
// Parses given buffer [aBeg, aEnd) for a valid VBRI header.
|
||||
// Parses contents of given ByteReader for a valid VBRI header.
|
||||
// The initial ByteReader offset will be preserved. It also needs to point
|
||||
// to the beginning of a valid MPEG frame, as VBRI headers are searched
|
||||
// at a fixed offset relative to frame begin.
|
||||
// Returns whether a valid VBRI header was found in the range.
|
||||
bool ParseVBRI(const uint8_t* aBeg, const uint8_t* aEnd);
|
||||
bool ParseVBRI(mp4_demuxer::ByteReader* aReader);
|
||||
|
||||
// The total number of frames expected as parsed from a VBR header.
|
||||
int64_t mNumFrames;
|
||||
@ -294,15 +296,17 @@ public:
|
||||
// - resets ID3Header if no valid header was parsed yet
|
||||
void EndFrameSession();
|
||||
|
||||
// Parses given buffer [aBeg, aEnd) for a valid frame header and returns a FrameParserResult.
|
||||
// FrameParserResult.mBufferPos points to begin of frame header if a frame header was found
|
||||
// or to aEnd otherwise. FrameParserResult.mBytesToSkip indicates whether additional bytes need to
|
||||
// be skipped in order to jump across an ID3 tag that stretches beyond the given buffer.
|
||||
FrameParserResult Parse(const uint8_t* aBeg, const uint8_t* aEnd);
|
||||
// Parses contents of given ByteReader for a valid frame header and returns true
|
||||
// if one was found. After returning, the variable passed to 'aBytesToSkip' holds
|
||||
// the amount of bytes to be skipped (if any) in order to jump across a large
|
||||
// ID3v2 tag spanning multiple buffers.
|
||||
bool Parse(mp4_demuxer::ByteReader* aReader, uint32_t* aBytesToSkip);
|
||||
|
||||
// Parses given buffer [aBeg, aEnd) for a valid VBR header.
|
||||
// Parses contents of given ByteReader for a valid VBR header.
|
||||
// The offset of the passed ByteReader needs to point to an MPEG frame begin,
|
||||
// as a VBRI-style header is searched at a fixed offset relative to frame begin.
|
||||
// Returns whether a valid VBR header was found.
|
||||
bool ParseVBRHeader(const uint8_t* aBeg, const uint8_t* aEnd);
|
||||
bool ParseVBRHeader(mp4_demuxer::ByteReader* aReader);
|
||||
|
||||
private:
|
||||
// ID3 header parser.
|
||||
@ -324,7 +328,7 @@ private:
|
||||
// MPEG streams.
|
||||
class MP3TrackDemuxer : public MediaTrackDemuxer {
|
||||
public:
|
||||
// Constructor, expecing a valid media resource.
|
||||
// Constructor, expecting a valid media resource.
|
||||
explicit MP3TrackDemuxer(MediaResource* aSource);
|
||||
|
||||
// Initializes the track demuxer by reading the first frame for meta data.
|
||||
|
@ -1269,11 +1269,6 @@ MediaDecoder::SetStateMachine(MediaDecoderStateMachine* aStateMachine)
|
||||
}
|
||||
}
|
||||
|
||||
ReentrantMonitor&
|
||||
MediaDecoder::GetReentrantMonitor() {
|
||||
return mReentrantMonitor;
|
||||
}
|
||||
|
||||
ImageContainer*
|
||||
MediaDecoder::GetImageContainer()
|
||||
{
|
||||
|
@ -524,10 +524,6 @@ public:
|
||||
MediaDecoderStateMachine* GetStateMachine() const;
|
||||
void SetStateMachine(MediaDecoderStateMachine* aStateMachine);
|
||||
|
||||
// Returns the monitor for other threads to synchronise access to
|
||||
// state.
|
||||
ReentrantMonitor& GetReentrantMonitor() override;
|
||||
|
||||
// Constructs the time ranges representing what segments of the media
|
||||
// are buffered and playable.
|
||||
virtual media::TimeIntervals GetBuffered();
|
||||
|
@ -16,8 +16,7 @@ extern PRLogModuleInfo* gMediaDecoderLog;
|
||||
NS_IMPL_ISUPPORTS0(BufferDecoder)
|
||||
|
||||
BufferDecoder::BufferDecoder(MediaResource* aResource)
|
||||
: mReentrantMonitor("BufferDecoder")
|
||||
, mResource(aResource)
|
||||
: mResource(aResource)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_COUNT_CTOR(BufferDecoder);
|
||||
@ -39,12 +38,6 @@ BufferDecoder::BeginDecoding(TaskQueue* aTaskQueueIdentity)
|
||||
mTaskQueueIdentity = aTaskQueueIdentity;
|
||||
}
|
||||
|
||||
ReentrantMonitor&
|
||||
BufferDecoder::GetReentrantMonitor()
|
||||
{
|
||||
return mReentrantMonitor;
|
||||
}
|
||||
|
||||
bool
|
||||
BufferDecoder::OnStateMachineTaskQueue() const
|
||||
{
|
||||
|
@ -31,8 +31,6 @@ public:
|
||||
// This has to be called before decoding begins
|
||||
void BeginDecoding(TaskQueue* aTaskQueueIdentity);
|
||||
|
||||
virtual ReentrantMonitor& GetReentrantMonitor() final override;
|
||||
|
||||
virtual bool OnStateMachineTaskQueue() const final override;
|
||||
|
||||
virtual bool OnDecodeTaskQueue() const final override;
|
||||
@ -67,11 +65,6 @@ public:
|
||||
|
||||
private:
|
||||
virtual ~BufferDecoder();
|
||||
|
||||
// This monitor object is not really used to synchronize access to anything.
|
||||
// It's just there in order for us to be able to override
|
||||
// GetReentrantMonitor correctly.
|
||||
ReentrantMonitor mReentrantMonitor;
|
||||
nsRefPtr<TaskQueue> mTaskQueueIdentity;
|
||||
nsRefPtr<MediaResource> mResource;
|
||||
};
|
||||
|
@ -2211,10 +2211,9 @@ TelephonyService.prototype = {
|
||||
aFailCause = RIL.GECKO_CALL_ERROR_NORMAL_CALL_CLEARING) {
|
||||
if (DEBUG) debug("_disconnectCalls: " + JSON.stringify(aCalls));
|
||||
|
||||
// Child cannot live without parent. Let's find all the calls that need to
|
||||
// be disconnected.
|
||||
// In addition to the disconnected call itself, its decedent calls should be
|
||||
// treated as disconnected calls as well.
|
||||
let disconnectedCalls = aCalls.slice();
|
||||
|
||||
for (let call in aCalls) {
|
||||
while (call.childId) {
|
||||
call = this._currentCalls[aClientId][call.childId];
|
||||
@ -2231,8 +2230,8 @@ TelephonyService.prototype = {
|
||||
call.state = nsITelephonyService.CALL_STATE_DISCONNECTED;
|
||||
call.disconnectedReason = aFailCause;
|
||||
|
||||
if (call.parentId) {
|
||||
let parentCall = this._currentCalls[aClientId][call.parentId];
|
||||
let parentCall = this._currentCalls[aClientId][call.parentId];
|
||||
if (parentCall) {
|
||||
delete parentCall.childId;
|
||||
}
|
||||
|
||||
|
@ -99,6 +99,121 @@ var emulator = (function() {
|
||||
};
|
||||
}());
|
||||
|
||||
/**
|
||||
* Modem Helper
|
||||
*
|
||||
* TODO: Should select which modem here to support multi-SIM
|
||||
*/
|
||||
|
||||
function modemHelperGenerator() {
|
||||
function Modem(aClientID) {
|
||||
this.clientID = aClientID;
|
||||
}
|
||||
Modem.prototype = {
|
||||
clientID: 0,
|
||||
|
||||
voiceTypeToTech: function(aVoiceType) {
|
||||
switch(aVoiceType) {
|
||||
case "gsm":
|
||||
case "gprs":
|
||||
case "edge":
|
||||
return "gsm";
|
||||
|
||||
case "umts":
|
||||
case "hsdpa":
|
||||
case "hsupa":
|
||||
case "hspa":
|
||||
case "hspa+":
|
||||
return "wcdma";
|
||||
|
||||
case "is95a":
|
||||
case "is95b":
|
||||
case "1xrtt":
|
||||
return "cdma";
|
||||
|
||||
case "evdo0":
|
||||
case "evdoa":
|
||||
case "evdob":
|
||||
return "evdo";
|
||||
|
||||
case "ehrpd":
|
||||
return "ehrpd";
|
||||
|
||||
case "lte":
|
||||
return "lte";
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
isCDMA: function() {
|
||||
var mobileConn = navigator.mozMobileConnections[this.clientID];
|
||||
var tech = mobileConn && this.voiceTypeToTech(mobileConn.voice.type);
|
||||
return tech === "cdma" || tech === "evdo" || tech == "ehrpd";
|
||||
},
|
||||
|
||||
isGSM: function() {
|
||||
var mobileConn = navigator.mozMobileConnections[this.clientID];
|
||||
var tech = mobileConn && this.voiceTypeToTech(mobileConn.voice.type);
|
||||
return tech === "gsm" || tech === "wcdma" || tech === "lte";
|
||||
},
|
||||
|
||||
/**
|
||||
* @return Promise:
|
||||
*/
|
||||
changeTech: function(aTech, aMask) {
|
||||
let target = navigator.mozMobileConnections[this.clientID];
|
||||
|
||||
let mask = aMask || {
|
||||
gsm: "gsm",
|
||||
wcdma: "gsm/wcdma",
|
||||
cdma: "cdma",
|
||||
evdo: "evdo0",
|
||||
ehrpd: "ehrpd",
|
||||
lte: "lte"
|
||||
}[aTech];
|
||||
|
||||
let waitForExpectedTech = () => {
|
||||
return new Promise((aResolve, aReject) => {
|
||||
let listener = aEvent => {
|
||||
log("MobileConnection[" + this.clientID + "] " +
|
||||
"received event 'voicechange'");
|
||||
if (aTech === this.voiceTypeToTech(target.voice.type)) {
|
||||
target.removeEventListener("voicechange", listener);
|
||||
aResolve();
|
||||
}
|
||||
};
|
||||
|
||||
target.addEventListener("voicechange", listener);
|
||||
});
|
||||
};
|
||||
|
||||
// TODO: Should select a modem here to support multi-SIM
|
||||
let changeToExpectedTech = () => {
|
||||
return Promise.resolve()
|
||||
.then(() => emulator.runCmd("modem tech " + aTech + " " + mask))
|
||||
.then(() => emulator.runCmd("modem tech"))
|
||||
.then(result => is(result[0], aTech + " " + mask,
|
||||
"Check modem 'tech/preferred mask'"));
|
||||
}
|
||||
|
||||
return aTech === this.voiceTypeToTech(target.voice.type)
|
||||
? Promise.resolve()
|
||||
: Promise.all([waitForExpectedTech(), changeToExpectedTech()]);
|
||||
}
|
||||
};
|
||||
|
||||
let modems = [];
|
||||
for (let i = 0; i < navigator.mozMobileConnections.length; ++i) {
|
||||
modems.push(new Modem(i));
|
||||
}
|
||||
return modems;
|
||||
}
|
||||
|
||||
let Modems = modemHelperGenerator();
|
||||
let Modem = Modems[0];
|
||||
|
||||
/**
|
||||
* Telephony related helper functions.
|
||||
*/
|
||||
@ -276,70 +391,6 @@ var emulator = (function() {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param aVoiceType
|
||||
* The voice type of a mobileConnection, which can be obtained from
|
||||
* |<mobileConnection>.voice.type|.
|
||||
* @return A string with format of the emulator voice tech.
|
||||
*/
|
||||
function voiceTypeToTech(aVoiceType) {
|
||||
switch(aVoiceType) {
|
||||
case "gsm":
|
||||
case "gprs":
|
||||
case "edge":
|
||||
return "gsm";
|
||||
|
||||
case "umts":
|
||||
case "hsdpa":
|
||||
case "hsupa":
|
||||
case "hspa":
|
||||
case "hspa+":
|
||||
return "wcdma";
|
||||
|
||||
case "is95a":
|
||||
case "is95b":
|
||||
case "1xrtt":
|
||||
return "cdma";
|
||||
|
||||
case "evdo0":
|
||||
case "evdoa":
|
||||
case "evdob":
|
||||
return "evdo";
|
||||
|
||||
case "ehrpd":
|
||||
case "lte":
|
||||
return "lte";
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Promise
|
||||
*/
|
||||
function changeModemTech(aTech, aPreferredMask) {
|
||||
let mobileConn = navigator.mozMobileConnections[0];
|
||||
|
||||
function isTechMatched() {
|
||||
return aTech === voiceTypeToTech(mobileConn.voice.type);
|
||||
}
|
||||
|
||||
let promise1 = isTechMatched() ? Promise.resolve()
|
||||
: waitForEvent(mobileConn,
|
||||
"voicechange",
|
||||
isTechMatched);
|
||||
|
||||
let promise2 = Promise.resolve()
|
||||
.then(() => emulator.runCmd("modem tech " + aTech + " " + aPreferredMask))
|
||||
.then(() => emulator.runCmd("modem tech"))
|
||||
.then(result => is(result[0],
|
||||
aTech + " " + aPreferredMask,
|
||||
"Check modem 'tech/preferred mask'"));
|
||||
|
||||
return Promise.all([promise1, promise2]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Promise
|
||||
*/
|
||||
@ -361,7 +412,7 @@ var emulator = (function() {
|
||||
|
||||
return Promise.all(hangUpPromises)
|
||||
.then(() => {
|
||||
return emulator.runCmd("gsm clear").then(waitForNoCall);
|
||||
return emulator.runCmd("telephony clear").then(waitForNoCall);
|
||||
})
|
||||
.then(waitForNoCall);
|
||||
}
|
||||
@ -423,6 +474,11 @@ var emulator = (function() {
|
||||
checkState(null, [], "", []);
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
**** Check Functions ****
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* Convenient helper to compare two call lists (order is not important).
|
||||
*/
|
||||
@ -478,7 +534,7 @@ var emulator = (function() {
|
||||
* @return Promise
|
||||
*/
|
||||
function checkEmulatorCallList(expectedCallList) {
|
||||
return emulator.runCmd("gsm list").then(result => {
|
||||
return emulator.runCmd("telephony list").then(result => {
|
||||
log("Call list is now: " + result);
|
||||
for (let i = 0; i < expectedCallList.length; ++i) {
|
||||
is(result[i], expectedCallList[i], "emulator calllist");
|
||||
@ -532,8 +588,168 @@ var emulator = (function() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Request utility functions.
|
||||
* The factory function for creating an expected call.
|
||||
*
|
||||
* @param aReference
|
||||
* The reference of the telephonyCall object.
|
||||
* @param aNumber
|
||||
* The call number.
|
||||
* @param aConference
|
||||
* Shows whether the call belongs to the conference.
|
||||
* @param aDirection
|
||||
* The direction of the call, "in" for inbound, and "out" for outbound.
|
||||
* @param aState
|
||||
* The expected state of the call.
|
||||
* @param aEmulatorState
|
||||
* The state logged in emulator now, may be different from aState.
|
||||
* @param aDisconnectedReason
|
||||
* The disconnected reason if the call becomed disconnected.
|
||||
*/
|
||||
function createExptectedCall(aReference, aNumber, aConference, aDirection,
|
||||
aState, aEmulatorState, aDisconnectedReason) {
|
||||
return {
|
||||
reference: aReference,
|
||||
number: aNumber,
|
||||
conference: aConference,
|
||||
direction: aDirection,
|
||||
state: aState,
|
||||
emulatorState: aEmulatorState,
|
||||
disconnectedReason: aDisconnectedReason
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Check telephony.active
|
||||
*
|
||||
* @param aExpectedCalls
|
||||
* An array of expected calls.
|
||||
* @param aExpectedCallsInConference
|
||||
* An array of expected calls in the conference.
|
||||
*/
|
||||
function checkActive(aExpectedCalls, aExpectedCallsInConference) {
|
||||
// Get the active call
|
||||
let calls = aExpectedCalls && aExpectedCalls.filter(aExpectedCall => {
|
||||
return aExpectedCall.state === "connected" ||
|
||||
aExpectedCall.state === "alerting" ||
|
||||
aExpectedCall.state === "dialing";
|
||||
});
|
||||
|
||||
ok(calls.length < 2, "Too many actives call in telephony.calls");
|
||||
let activeCall = calls.length ? calls[0].reference : null;
|
||||
|
||||
// Get the active conference
|
||||
let callsInConference = aExpectedCallsInConference || [];
|
||||
let activeConference = callsInConference.length &&
|
||||
callsInConference[0].state === "connected"
|
||||
? navigator.mozTelephony.conferenceGroup
|
||||
: null;
|
||||
|
||||
// Check telephony.active
|
||||
ok(!(activeCall && activeConference),
|
||||
"An active call cannot coexist with an active conference call.");
|
||||
is(telephony.active, activeCall || activeConference, "check Active");
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the data in telephony and emulator meets our expectation.
|
||||
*
|
||||
* NOTE: Conference call is not supported in this function yet, so related
|
||||
* checks are skipped.
|
||||
*
|
||||
* Fulfill params:
|
||||
* {
|
||||
* reference, -- the reference of the call object instance.
|
||||
* number, -- the call number.
|
||||
* conference, -- shows whether it belongs to the conference.
|
||||
* direction, -- "in" for inbound, and "out" for outbound.
|
||||
* state, -- the call state.
|
||||
* emulatorState, -- the call state logged in emulator now.
|
||||
* disconnectedReason, -- the disconnected reason of a disconnected call.
|
||||
* }
|
||||
*
|
||||
* @param aExpectedCalls
|
||||
* An array of call records.
|
||||
* @return Promise
|
||||
*/
|
||||
function equals(aExpectedCalls) {
|
||||
// Classify calls
|
||||
let callsInTelephony = [];
|
||||
let CallsInConference = [];
|
||||
|
||||
aExpectedCalls.forEach(function(aCall) {
|
||||
if (aCall.state === "disconnected") {
|
||||
is(aCall.disconnectedReason,
|
||||
aCall.reference.disconnectedReason,
|
||||
"Check disconnectedReason");
|
||||
return;
|
||||
}
|
||||
|
||||
if (aCall.conference) {
|
||||
CallsInConference.push(aCall);
|
||||
return;
|
||||
}
|
||||
|
||||
callsInTelephony.push(aCall);
|
||||
ok(!aCall.secondId, "For a telephony call, the secondId must be null");
|
||||
});
|
||||
|
||||
// Check the active connection
|
||||
checkActive(callsInTelephony, CallsInConference);
|
||||
|
||||
// Check telephony.calls
|
||||
is(telephony.calls.length,
|
||||
callsInTelephony.length,
|
||||
"Check telephony.calls.length");
|
||||
|
||||
callsInTelephony.forEach(aExpectedCall => {
|
||||
let number = aExpectedCall.number;
|
||||
let call = telephony.calls.find(aCall => aCall.id.number === number);
|
||||
if (!call) {
|
||||
ok(false, "telephony.calls lost the call(number: " + number + ")");
|
||||
return;
|
||||
}
|
||||
|
||||
is(call, aExpectedCall.reference,
|
||||
"Check the object reference of number:" + number);
|
||||
|
||||
is(call.state, aExpectedCall.state,
|
||||
"Check call.state of number:" + number);
|
||||
});
|
||||
|
||||
// Check conference.calls
|
||||
// NOTE: This function doesn't support conference call now, so the length of
|
||||
// |CallsInConference| should be 0, and the conference state shoul be "".
|
||||
is(conference.state, "", "Conference call is not supported yet.");
|
||||
is(CallsInConference.length, 0, "Conference call is not supported yet.");
|
||||
|
||||
// Check the emulator call list
|
||||
// NOTE: Conference is not supported yet, so |CallsInConference| is ignored.
|
||||
let strings = callsInTelephony.map(aCall => {
|
||||
// The emulator doesn't have records for disconnected calls.
|
||||
if (aCall.emulatorState === "disconnected") {
|
||||
return null;
|
||||
}
|
||||
|
||||
let state = {
|
||||
alerting: "ringing",
|
||||
connected: "active",
|
||||
held: "held",
|
||||
incoming: "incoming"
|
||||
}[aCall.state];
|
||||
|
||||
state = aCall.emulatorState || state;
|
||||
let prefix = (aCall.direction === "in") ? "inbound from "
|
||||
: "outbound to ";
|
||||
|
||||
return state ? (prefix + aCall.number + " : " + state) : null;
|
||||
});
|
||||
|
||||
return checkEmulatorCallList(strings.filter(aString => aString));
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
**** Request utility functions ****
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* Make an outgoing call.
|
||||
@ -558,7 +774,13 @@ var emulator = (function() {
|
||||
is(outCall.state, "dialing");
|
||||
is(outCall.serviceId, serviceId);
|
||||
})
|
||||
.then(() => waitForNamedStateEvent(outCall, "alerting"));
|
||||
.then(() => {
|
||||
// A CDMA call goes to connected state directly when the operator find
|
||||
// its callee, which makes the "connected" state in CDMA calls behaves
|
||||
// like the "alerting" state in GSM calls.
|
||||
let state = Modems[serviceId].isGSM() ? "alerting" : "connected";
|
||||
return waitForNamedStateEvent(outCall, state);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -581,7 +803,13 @@ var emulator = (function() {
|
||||
is(outCall.id.number, number);
|
||||
is(outCall.state, "dialing");
|
||||
})
|
||||
.then(() => waitForNamedStateEvent(outCall, "alerting"))
|
||||
.then(() => {
|
||||
// Similar to function |dial|, a CDMA call directly goes to connected
|
||||
// state when the operator find its callee.
|
||||
let state = Modems[outCall.serviceId].isGSM() ? "alerting"
|
||||
: "connected";
|
||||
return waitForNamedStateEvent(outCall, state);
|
||||
})
|
||||
.then(() => {
|
||||
is(outCall.emergency, true, "check emergency");
|
||||
return outCall;
|
||||
@ -651,19 +879,23 @@ var emulator = (function() {
|
||||
/**
|
||||
* Hold a call.
|
||||
*
|
||||
* @param call
|
||||
* @param aCall
|
||||
* A TelephonyCall object.
|
||||
* @param aWaitForEvent
|
||||
* Decide whether to wait for the state event.
|
||||
* @return Promise<TelephonyCall>
|
||||
*/
|
||||
function hold(call) {
|
||||
function hold(aCall, aWaitForEvent = true) {
|
||||
log("Putting the call on hold.");
|
||||
|
||||
let promises = [];
|
||||
|
||||
promises.push(waitForNamedStateEvent(call, "held"));
|
||||
promises.push(call.hold());
|
||||
if (aWaitForEvent) {
|
||||
promises.push(waitForNamedStateEvent(aCall, "held"));
|
||||
}
|
||||
promises.push(aCall.hold());
|
||||
|
||||
return Promise.all(promises).then(() => call);
|
||||
return Promise.all(promises).then(() => aCall);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -673,7 +905,7 @@ var emulator = (function() {
|
||||
* A TelephonyCall object.
|
||||
* @return Promise<TelephonyCall>
|
||||
*/
|
||||
function resume(call) {
|
||||
function resume(call, aWaitForEvent = true) {
|
||||
log("Resuming the held call.");
|
||||
|
||||
let promises = [];
|
||||
@ -721,8 +953,10 @@ var emulator = (function() {
|
||||
numberPresentation = numberPresentation || "";
|
||||
name = name || "";
|
||||
namePresentation = namePresentation || "";
|
||||
emulator.runCmd("gsm call " + number + "," + numberPresentation + "," + name +
|
||||
"," + namePresentation);
|
||||
emulator.runCmd("telephony call " + number +
|
||||
"," + numberPresentation +
|
||||
"," + name +
|
||||
"," + namePresentation);
|
||||
|
||||
return waitForEvent(telephony, "incoming")
|
||||
.then(event => {
|
||||
@ -747,9 +981,14 @@ var emulator = (function() {
|
||||
function remoteAnswer(call) {
|
||||
log("Remote answering the call: " + call.id.number);
|
||||
|
||||
emulator.runCmd("gsm accept " + call.id.number);
|
||||
emulator.runCmd("telephony accept " + call.id.number);
|
||||
|
||||
return waitForNamedStateEvent(call, "connected");
|
||||
// A CDMA call goes to connected state directly when the operator find its
|
||||
// callee, which makes the "connected" state in CDMA calls behaves like the
|
||||
// "alerting" state in GSM calls, so we don't have to wait for the call to
|
||||
// change to "connected" state here for CDMA calls.
|
||||
return Modem.isCDMA() ? Promise.resolve()
|
||||
: waitForNamedStateEvent(call, "connected");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -762,7 +1001,7 @@ var emulator = (function() {
|
||||
function remoteHangUp(call) {
|
||||
log("Remote hanging up the call: " + call.id.number);
|
||||
|
||||
emulator.runCmd("gsm cancel " + call.id.number);
|
||||
emulator.runCmd("telephony cancel " + call.id.number);
|
||||
|
||||
return waitForNamedStateEvent(call, "disconnected");
|
||||
}
|
||||
@ -1216,7 +1455,6 @@ var emulator = (function() {
|
||||
this.gWaitForNamedStateEvent = waitForNamedStateEvent;
|
||||
this.gWaitForStateChangeEvent = waitForStateChangeEvent;
|
||||
this.gCheckInitialState = checkInitialState;
|
||||
this.gChangeModemTech = changeModemTech;
|
||||
this.gClearCalls = clearCalls;
|
||||
this.gOutCallStrPool = outCallStrPool;
|
||||
this.gInCallStrPool = inCallStrPool;
|
||||
@ -1244,6 +1482,25 @@ var emulator = (function() {
|
||||
this.gSetupConference = setupConference;
|
||||
this.gSetRadioEnabled = setRadioEnabled;
|
||||
this.gSetRadioEnabledAll = setRadioEnabledAll;
|
||||
|
||||
// Telephony helper
|
||||
this.TelephonyHelper = {
|
||||
dial: dial,
|
||||
answer: answer,
|
||||
hangUp: hangUp,
|
||||
hold: hold,
|
||||
resume: resume,
|
||||
equals: equals,
|
||||
createExptectedCall: createExptectedCall
|
||||
};
|
||||
|
||||
// Remote Utils, TODO: This should be an array for multi-SIM scenarios
|
||||
this.Remotes = [{
|
||||
dial: remoteDial,
|
||||
answer: remoteAnswer,
|
||||
hangUp: remoteHangUp
|
||||
}];
|
||||
this.Remote = this.Remotes[0];
|
||||
}());
|
||||
|
||||
function _startTest(permissions, test) {
|
||||
|
@ -24,6 +24,8 @@ qemu = true
|
||||
[test_dtmf.js]
|
||||
[test_emergency.js]
|
||||
[test_emergency_label.js]
|
||||
[test_gsm_cdma_incoming_basic_operations.js]
|
||||
[test_gsm_cdma_outgoing_basic_operations.js]
|
||||
[test_incall_mmi_call_hold.js]
|
||||
[test_incall_mmi_call_waiting.js]
|
||||
[test_incall_mmi_conference.js]
|
||||
@ -31,7 +33,6 @@ qemu = true
|
||||
[test_incoming_already_connected.js]
|
||||
[test_incoming_already_held.js]
|
||||
[test_incoming_answer_hangup_oncallschanged.js]
|
||||
[test_incoming_basic_operations.js]
|
||||
[test_incoming_onstatechange.js]
|
||||
[test_mmi_call_barring.js]
|
||||
[test_mmi_call_forwarding.js]
|
||||
@ -52,7 +53,6 @@ qemu = true
|
||||
[test_outgoing_answer_radio_off.js]
|
||||
[test_outgoing_auto_hold.js]
|
||||
[test_outgoing_badNumber.js]
|
||||
[test_outgoing_basic_operations.js]
|
||||
[test_outgoing_busy.js]
|
||||
[test_outgoing_from_stk.js]
|
||||
[test_outgoing_onstatechange.js]
|
||||
@ -64,3 +64,4 @@ qemu = true
|
||||
[test_system_message_telephony_call_ended.js]
|
||||
[test_TelephonyUtils.js]
|
||||
[test_temporary_clir.js]
|
||||
|
||||
|
@ -78,7 +78,7 @@ function test_oneCall() {
|
||||
let p = waitForStateChanged(aAllInfo => {
|
||||
return aAllInfo[0].callState === Ci.nsITelephonyService.CALL_STATE_CONNECTED;
|
||||
});
|
||||
emulator.runCmd("gsm accept " + number);
|
||||
emulator.runCmd("telephony accept " + number);
|
||||
return p;
|
||||
})
|
||||
.then(() => {
|
||||
@ -87,7 +87,7 @@ function test_oneCall() {
|
||||
})
|
||||
.then(() => {
|
||||
let p = TelephonyUtils.waitForNoCalls();
|
||||
emulator.runCmd("gsm cancel " + number);
|
||||
emulator.runCmd("telephony cancel " + number);
|
||||
return p;
|
||||
});
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ startTest(function() {
|
||||
|
||||
// Disable the Hold function of the emulator, then hold the active call,
|
||||
// where the hold request will fail and the call will remain active.
|
||||
.then(() => emulator.runCmd("gsm disable hold"))
|
||||
.then(() => emulator.runCmd("telephony disable hold"))
|
||||
.then(() => gHold(inCall))
|
||||
.then(() => ok(false, "This hold request should be rejected."),
|
||||
() => log("This hold request is rejected as expected."))
|
||||
@ -33,7 +33,7 @@ startTest(function() {
|
||||
|
||||
// Enable the Hold function of the emulator, then hold the active call,
|
||||
// where the hold request should succeed and the call should become held.
|
||||
.then(() => emulator.runCmd("gsm enable hold"))
|
||||
.then(() => emulator.runCmd("telephony enable hold"))
|
||||
.then(() => gHold(inCall))
|
||||
.then(() => log("This hold request is resolved as expected."),
|
||||
() => ok(false, "This hold request should be resolved."))
|
||||
@ -47,6 +47,6 @@ startTest(function() {
|
||||
|
||||
// Clean Up
|
||||
.catch(error => ok(false, "Promise reject: " + error))
|
||||
.then(() => emulator.runCmd("gsm enable hold"))
|
||||
.then(() => emulator.runCmd("telephony enable hold"))
|
||||
.then(finish);
|
||||
});
|
||||
|
@ -0,0 +1,170 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 90000;
|
||||
MARIONETTE_HEAD_JS = 'head.js';
|
||||
|
||||
/******************************************************************************
|
||||
**** Basic Operations ****
|
||||
******************************************************************************/
|
||||
|
||||
const IncomingNumber = "1111110000";
|
||||
|
||||
function exptectedCall(aCall, aState, aEmulatorState = null) {
|
||||
let disconnectedReason = aState === "disconnected" ? "NormalCallClearing"
|
||||
: null;
|
||||
|
||||
return TelephonyHelper.createExptectedCall(aCall, IncomingNumber, false,
|
||||
"in", aState, aEmulatorState,
|
||||
disconnectedReason);
|
||||
}
|
||||
|
||||
function incoming(aNumber) {
|
||||
let ret;
|
||||
return Remote.dial(aNumber)
|
||||
.then(call => ret = call)
|
||||
.then(() => TelephonyHelper.equals([exptectedCall(ret, "incoming")]))
|
||||
.then(() => ret);
|
||||
}
|
||||
|
||||
function answer(aCall) {
|
||||
let call = exptectedCall(aCall, "connected");
|
||||
return TelephonyHelper.answer(aCall)
|
||||
.then(() => TelephonyHelper.equals([call]))
|
||||
.then(() => aCall);
|
||||
}
|
||||
|
||||
function hold(aCall) {
|
||||
// Since a CDMA call doesn't have any notification for its state changing to
|
||||
// "held" state, a telephonyCall is still remains in "connected" state when
|
||||
// the call actually goes to "held" state, and we shouldn't wait for the state
|
||||
// change event here.
|
||||
let state = Modem.isGSM() ? "held" : "connected";
|
||||
let call = exptectedCall(aCall, state,"held");
|
||||
return TelephonyHelper.hold(aCall, Modem.isGSM())
|
||||
.then(() => TelephonyHelper.equals([call]))
|
||||
.then(() => aCall);
|
||||
}
|
||||
|
||||
function resume(aCall) {
|
||||
// Similar to the hold case, there is no notification for a CDMA call's state
|
||||
// change. Besides, a CDMA call still remains in "connected" state here, so we
|
||||
// have to use |hold()| function here to resume the call. Otherwise, if we use
|
||||
// |resume()| function, we'll get an invalid state error.
|
||||
let call = exptectedCall(aCall, "connected");
|
||||
return Modem.isGSM() ? TelephonyHelper.resume(aCall)
|
||||
: TelephonyHelper.hold(aCall, false)
|
||||
.then(() => TelephonyHelper.equals([call]))
|
||||
.then(() => aCall);
|
||||
}
|
||||
|
||||
function hangUp(aCall) {
|
||||
let call = exptectedCall(aCall, "disconnected");
|
||||
return TelephonyHelper.hangUp(aCall)
|
||||
.then(() => TelephonyHelper.equals([call]))
|
||||
.then(() => aCall);
|
||||
}
|
||||
|
||||
function remoteHangUp(aCall) {
|
||||
let call = exptectedCall(aCall, "disconnected");
|
||||
return Remote.hangUp(aCall)
|
||||
.then(() => TelephonyHelper.equals([call]))
|
||||
.then(() => aCall);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
**** Testcases ****
|
||||
******************************************************************************/
|
||||
|
||||
function testIncomingReject() {
|
||||
log("= testIncomingReject =");
|
||||
return incoming(IncomingNumber)
|
||||
.then(call => hangUp(call));
|
||||
}
|
||||
|
||||
function testIncomingCancel() {
|
||||
log("= testIncomingCancel =");
|
||||
return incoming(IncomingNumber)
|
||||
.then(call => remoteHangUp(call));
|
||||
}
|
||||
|
||||
function testIncomingAnswerHangUp() {
|
||||
log("= testIncomingAnswerHangUp =");
|
||||
return incoming(IncomingNumber)
|
||||
.then(call => answer(call))
|
||||
.then(call => hangUp(call));
|
||||
}
|
||||
|
||||
function testIncomingAnswerRemoteHangUp() {
|
||||
log("= testIncomingAnswerRemoteHangUp =");
|
||||
return incoming(IncomingNumber)
|
||||
.then(call => answer(call))
|
||||
.then(call => remoteHangUp(call));
|
||||
}
|
||||
|
||||
function testIncomingAnswerHoldHangUp() {
|
||||
log("= testIncomingAnswerHoldHangUp =");
|
||||
return incoming(IncomingNumber)
|
||||
.then(call => answer(call))
|
||||
.then(call => hold(call))
|
||||
.then(call => hangUp(call));
|
||||
}
|
||||
|
||||
function testIncomingAnswerHoldRemoteHangUp() {
|
||||
log("= testIncomingAnswerHoldRemoteHangUp =");
|
||||
return incoming(IncomingNumber)
|
||||
.then(call => answer(call))
|
||||
.then(call => hold(call))
|
||||
.then(call => remoteHangUp(call));
|
||||
}
|
||||
|
||||
function testIncomingAnswerHoldResumeHangUp() {
|
||||
log("= testIncomingAnswerHoldResumeHangUp =");
|
||||
return incoming(IncomingNumber)
|
||||
.then(call => answer(call))
|
||||
.then(call => hold(call))
|
||||
.then(call => resume(call))
|
||||
.then(call => hangUp(call));
|
||||
}
|
||||
|
||||
function testIncomingAnswerHoldResumeRemoteHangUp() {
|
||||
log("= testIncomingAnswerHoldResumeRemoteHangUp =");
|
||||
return incoming(IncomingNumber)
|
||||
.then(call => answer(call))
|
||||
.then(call => hold(call))
|
||||
.then(call => resume(call))
|
||||
.then(call => remoteHangUp(call));
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
**** Test Launcher ****
|
||||
******************************************************************************/
|
||||
|
||||
function runTestSuite(aTech, aTechMask) {
|
||||
return Promise.resolve()
|
||||
// Setup Environment
|
||||
.then(() => Modem.changeTech(aTech, aTechMask))
|
||||
|
||||
// Tests
|
||||
.then(() => testIncomingReject())
|
||||
.then(() => testIncomingCancel())
|
||||
.then(() => testIncomingAnswerHangUp())
|
||||
.then(() => testIncomingAnswerRemoteHangUp())
|
||||
.then(() => testIncomingAnswerHoldHangUp())
|
||||
.then(() => testIncomingAnswerHoldRemoteHangUp())
|
||||
.then(() => testIncomingAnswerHoldResumeHangUp())
|
||||
.then(() => testIncomingAnswerHoldResumeRemoteHangUp())
|
||||
|
||||
// Restore Environment
|
||||
.then(() => Modem.changeTech("wcdma"));
|
||||
}
|
||||
|
||||
startTest(function() {
|
||||
return Promise.resolve()
|
||||
.then(() => runTestSuite("cdma"))
|
||||
.then(() => runTestSuite("wcdma"))
|
||||
|
||||
.catch(error => ok(false, "Promise reject: " + error))
|
||||
.then(finish);
|
||||
});
|
||||
|
@ -0,0 +1,174 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 90000;
|
||||
MARIONETTE_HEAD_JS = 'head.js';
|
||||
|
||||
/******************************************************************************
|
||||
**** Basic Operations ****
|
||||
******************************************************************************/
|
||||
|
||||
const OutgoingNumber = "5555551111";
|
||||
|
||||
function exptectedCall(aCall, aState, aEmulatorState = null) {
|
||||
let disconnectedReason = aState === "disconnected" ? "NormalCallClearing"
|
||||
: null;
|
||||
|
||||
return TelephonyHelper.createExptectedCall(aCall, OutgoingNumber, false,
|
||||
"out", aState, aEmulatorState,
|
||||
disconnectedReason);
|
||||
}
|
||||
|
||||
function outgoing(aNumber) {
|
||||
let ret;
|
||||
|
||||
// Since a CDMA call doesn't have "alerting" state, it directly goes to
|
||||
// "connected" state instead.
|
||||
let state = Modem.isCDMA() ? "connected" : "alerting";
|
||||
return TelephonyHelper.dial(aNumber)
|
||||
.then(call => ret = call)
|
||||
.then(() => TelephonyHelper.equals([exptectedCall(ret, state)]))
|
||||
.then(() => ret);
|
||||
}
|
||||
|
||||
function remoteAnswer(aCall) {
|
||||
let call = exptectedCall(aCall, "connected");
|
||||
return Remote.answer(aCall)
|
||||
.then(() => TelephonyHelper.equals([call]))
|
||||
.then(() => aCall);
|
||||
}
|
||||
|
||||
function hold(aCall) {
|
||||
// Since a CDMA call doesn't have any notification for its state changing to
|
||||
// "held" state, a telephonyCall is still remains in "connected" state when
|
||||
// the call actually goes to "held" state, and we shouldn't wait for the state
|
||||
// change event here.
|
||||
let state = Modem.isGSM() ? "held" : "connected";
|
||||
let call = exptectedCall(aCall, state, "held");
|
||||
return TelephonyHelper.hold(aCall, Modem.isGSM())
|
||||
.then(() => TelephonyHelper.equals([call]))
|
||||
.then(() => aCall);
|
||||
}
|
||||
|
||||
function resume(aCall) {
|
||||
// Similar to the hold case, there is no notification for a CDMA call's state
|
||||
// change. Besides, a CDMA call still remains in "connected" state here, so we
|
||||
// have to use |hold()| function here to resume the call. Otherwise, if we use
|
||||
// |resume()| function, we'll get an invalid state error.
|
||||
let call = exptectedCall(aCall, "connected");
|
||||
return Modem.isGSM() ? TelephonyHelper.resume(aCall)
|
||||
: TelephonyHelper.hold(aCall, false)
|
||||
.then(() => TelephonyHelper.equals([call]))
|
||||
.then(() => aCall);
|
||||
}
|
||||
|
||||
function hangUp(aCall) {
|
||||
let call = exptectedCall(aCall, "disconnected");
|
||||
return TelephonyHelper.hangUp(aCall)
|
||||
.then(() => TelephonyHelper.equals([call]))
|
||||
.then(() => aCall);
|
||||
}
|
||||
|
||||
function remoteHangUp(aCall) {
|
||||
let call = exptectedCall(aCall, "disconnected");
|
||||
return Remote.hangUp(aCall)
|
||||
.then(() => TelephonyHelper.equals([call]))
|
||||
.then(() => aCall);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
**** Testcases ****
|
||||
******************************************************************************/
|
||||
|
||||
function testOutgoingReject() {
|
||||
log("= testOutgoingReject =");
|
||||
return outgoing(OutgoingNumber)
|
||||
.then(call => remoteHangUp(call));
|
||||
}
|
||||
|
||||
function testOutgoingCancel() {
|
||||
log("= testOutgoingCancel =");
|
||||
return outgoing(OutgoingNumber)
|
||||
.then(call => hangUp(call));
|
||||
}
|
||||
|
||||
function testOutgoingAnswerHangUp() {
|
||||
log("= testOutgoingAnswerHangUp =");
|
||||
return outgoing(OutgoingNumber)
|
||||
.then(call => remoteAnswer(call))
|
||||
.then(call => hangUp(call));
|
||||
}
|
||||
|
||||
function testOutgoingAnswerRemoteHangUp() {
|
||||
log("= testOutgoingAnswerRemoteHangUp =");
|
||||
return outgoing(OutgoingNumber)
|
||||
.then(call => remoteAnswer(call))
|
||||
.then(call => remoteHangUp(call));
|
||||
}
|
||||
|
||||
function testOutgoingAnswerHoldHangUp() {
|
||||
log("= testOutgoingAnswerHoldHangUp =");
|
||||
return outgoing(OutgoingNumber)
|
||||
.then(call => remoteAnswer(call))
|
||||
.then(call => hold(call))
|
||||
.then(call => hangUp(call));
|
||||
}
|
||||
|
||||
function testOutgoingAnswerHoldRemoteHangUp() {
|
||||
log("= testOutgoingAnswerHoldRemoteHangUp =");
|
||||
return outgoing(OutgoingNumber)
|
||||
.then(call => remoteAnswer(call))
|
||||
.then(call => hold(call))
|
||||
.then(call => remoteHangUp(call));
|
||||
}
|
||||
|
||||
function testOutgoingAnswerHoldResumeHangUp() {
|
||||
log("= testOutgoingAnswerHoldResumeHangUp =");
|
||||
return outgoing(OutgoingNumber)
|
||||
.then(call => remoteAnswer(call))
|
||||
.then(call => hold(call))
|
||||
.then(call => resume(call))
|
||||
.then(call => hangUp(call));
|
||||
}
|
||||
|
||||
function testOutgoingAnswerHoldResumeRemoteHangUp() {
|
||||
log("= testOutgoingAnswerHoldResumeRemoteHangUp =");
|
||||
return outgoing(OutgoingNumber)
|
||||
.then(call => remoteAnswer(call))
|
||||
.then(call => hold(call))
|
||||
.then(call => resume(call))
|
||||
.then(call => remoteHangUp(call));
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/*** Test Launcher ***/
|
||||
/******************************************************************************/
|
||||
|
||||
function runTestSuite(aTech, aTechMask) {
|
||||
return Promise.resolve()
|
||||
// Setup Environment
|
||||
.then(() => Modem.changeTech(aTech, aTechMask))
|
||||
|
||||
// Tests
|
||||
.then(() => testOutgoingReject())
|
||||
.then(() => testOutgoingCancel())
|
||||
.then(() => testOutgoingAnswerHangUp())
|
||||
.then(() => testOutgoingAnswerRemoteHangUp())
|
||||
.then(() => testOutgoingAnswerHoldHangUp())
|
||||
.then(() => testOutgoingAnswerHoldRemoteHangUp())
|
||||
.then(() => testOutgoingAnswerHoldResumeHangUp())
|
||||
.then(() => testOutgoingAnswerHoldResumeRemoteHangUp())
|
||||
|
||||
// Restore Environment
|
||||
.then(() => Modem.changeTech("wcdma"));
|
||||
}
|
||||
|
||||
startTest(function() {
|
||||
return Promise.resolve()
|
||||
.then(() => runTestSuite("cdma"))
|
||||
.then(() => runTestSuite("wcdma"))
|
||||
|
||||
.catch(error => ok(false, "Promise reject: " + error))
|
||||
.then(finish);
|
||||
});
|
||||
|
@ -1,123 +0,0 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 90000;
|
||||
MARIONETTE_HEAD_JS = 'head.js';
|
||||
|
||||
const inNumber = "5555552222";
|
||||
const inInfo = gInCallStrPool(inNumber);
|
||||
var inCall;
|
||||
|
||||
function incoming() {
|
||||
return gRemoteDial(inNumber)
|
||||
.then(call => inCall = call)
|
||||
.then(() => gCheckAll(null, [inCall], "", [], [inInfo.incoming]))
|
||||
.then(() => is(inCall.disconnectedReason, null));
|
||||
}
|
||||
|
||||
function answer() {
|
||||
return gAnswer(inCall)
|
||||
.then(() => gCheckAll(inCall, [inCall], "", [], [inInfo.active]))
|
||||
.then(() => is(inCall.disconnectedReason, null));
|
||||
}
|
||||
|
||||
function hold() {
|
||||
return gHold(inCall)
|
||||
.then(() => gCheckAll(null, [inCall], "", [], [inInfo.held]))
|
||||
.then(() => is(inCall.disconnectedReason, null));
|
||||
}
|
||||
|
||||
function resume() {
|
||||
return gResume(inCall)
|
||||
.then(() => gCheckAll(inCall, [inCall], "", [], [inInfo.active]))
|
||||
.then(() => is(inCall.disconnectedReason, null));
|
||||
}
|
||||
|
||||
function hangUp() {
|
||||
return gHangUp(inCall)
|
||||
.then(() => gCheckAll(null, [], "", [], []))
|
||||
.then(() => is(inCall.disconnectedReason, "NormalCallClearing"));
|
||||
}
|
||||
|
||||
function remoteHangUp() {
|
||||
return gRemoteHangUp(inCall)
|
||||
.then(() => gCheckAll(null, [], "", [], []))
|
||||
.then(() => is(inCall.disconnectedReason, "NormalCallClearing"));
|
||||
}
|
||||
|
||||
// Test cases.
|
||||
|
||||
function testIncomingReject() {
|
||||
log("= testIncomingReject =");
|
||||
return incoming()
|
||||
.then(() => hangUp());
|
||||
}
|
||||
|
||||
function testIncomingCancel() {
|
||||
log("= testIncomingCancel =");
|
||||
return incoming()
|
||||
.then(() => remoteHangUp());
|
||||
}
|
||||
|
||||
function testIncomingAnswerHangUp() {
|
||||
log("= testIncomingAnswerHangUp =");
|
||||
return incoming()
|
||||
.then(() => answer())
|
||||
.then(() => hangUp());
|
||||
}
|
||||
|
||||
function testIncomingAnswerRemoteHangUp() {
|
||||
log("= testIncomingAnswerRemoteHangUp =");
|
||||
return incoming()
|
||||
.then(() => answer())
|
||||
.then(() => remoteHangUp());
|
||||
}
|
||||
|
||||
function testIncomingAnswerHoldHangUp() {
|
||||
log("= testIncomingAnswerHoldHangUp =");
|
||||
return incoming()
|
||||
.then(() => answer())
|
||||
.then(() => hold())
|
||||
.then(() => hangUp());
|
||||
}
|
||||
|
||||
function testIncomingAnswerHoldRemoteHangUp() {
|
||||
log("= testIncomingAnswerHoldRemoteHangUp =");
|
||||
return incoming()
|
||||
.then(() => answer())
|
||||
.then(() => hold())
|
||||
.then(() => remoteHangUp());
|
||||
}
|
||||
|
||||
function testIncomingAnswerHoldResumeHangUp() {
|
||||
log("= testIncomingAnswerHoldResumeHangUp =");
|
||||
return incoming()
|
||||
.then(() => answer())
|
||||
.then(() => hold())
|
||||
.then(() => resume())
|
||||
.then(() => hangUp());
|
||||
}
|
||||
|
||||
function testIncomingAnswerHoldResumeRemoteHangUp() {
|
||||
log("= testIncomingAnswerHoldResumeRemoteHangUp =");
|
||||
return incoming()
|
||||
.then(() => answer())
|
||||
.then(() => hold())
|
||||
.then(() => resume())
|
||||
.then(() => remoteHangUp());
|
||||
}
|
||||
|
||||
startTest(function() {
|
||||
Promise.resolve()
|
||||
.then(() => testIncomingReject())
|
||||
.then(() => testIncomingCancel())
|
||||
.then(() => testIncomingAnswerHangUp())
|
||||
.then(() => testIncomingAnswerRemoteHangUp())
|
||||
.then(() => testIncomingAnswerHoldHangUp())
|
||||
.then(() => testIncomingAnswerHoldRemoteHangUp())
|
||||
.then(() => testIncomingAnswerHoldResumeHangUp())
|
||||
.then(() => testIncomingAnswerHoldResumeRemoteHangUp())
|
||||
|
||||
.catch(error => ok(false, "Promise reject: " + error))
|
||||
.then(finish);
|
||||
});
|
@ -39,7 +39,7 @@ var settings = [
|
||||
startTest(function() {
|
||||
|
||||
let promise = settings.reduce((aPromise, aSetting) => {
|
||||
return aPromise.then(() => gChangeModemTech(aSetting.tech, aSetting.mask));
|
||||
return aPromise.then(() => Modem.changeTech(aSetting.tech, aSetting.mask));
|
||||
}, Promise.resolve());
|
||||
|
||||
return promise
|
||||
@ -47,7 +47,7 @@ startTest(function() {
|
||||
.catch(error => ok(false, "Promise reject: " + error))
|
||||
|
||||
// Switch to the default modem tech
|
||||
.then(() => gChangeModemTech("wcdma", "gsm/wcdma"))
|
||||
.then(() => Modem.changeTech("wcdma", "gsm/wcdma"))
|
||||
.catch(error => ok(false, "Fetal Error: Promise reject: " + error))
|
||||
|
||||
.then(finish);
|
||||
|
@ -37,7 +37,7 @@ function testAutoHoldCallFailed() {
|
||||
const callNumber2 = "0900000012";
|
||||
|
||||
return Promise.resolve()
|
||||
.then(() => emulator.runCmd("gsm disable hold"))
|
||||
.then(() => emulator.runCmd("telephony disable hold"))
|
||||
.then(() => gDial(callNumber1))
|
||||
.then(call => { outCall1 = call; })
|
||||
.then(() => gRemoteAnswer(outCall1))
|
||||
@ -51,7 +51,7 @@ function testAutoHoldCallFailed() {
|
||||
return gRemoteHangUpCalls([outCall2]);
|
||||
}, () => log("The second |dial()| is rejected as expected."))
|
||||
.then(() => gRemoteHangUpCalls([outCall1]))
|
||||
.then(() => emulator.runCmd("gsm enable hold"));
|
||||
.then(() => emulator.runCmd("telephony enable hold"));
|
||||
}
|
||||
|
||||
function testAutoHoldConferenceCall() {
|
||||
@ -87,7 +87,7 @@ startTest(function() {
|
||||
.then(() => testAutoHoldConferenceCall())
|
||||
.catch(error => {
|
||||
ok(false, "Promise reject: " + error);
|
||||
emulator.runCmd("gsm enable hold");
|
||||
emulator.runCmd("telephony enable hold");
|
||||
})
|
||||
.then(finish);
|
||||
});
|
||||
|
@ -1,123 +0,0 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 90000;
|
||||
MARIONETTE_HEAD_JS = 'head.js';
|
||||
|
||||
const outNumber = "5555551111";
|
||||
const outInfo = gOutCallStrPool(outNumber);
|
||||
var outCall;
|
||||
|
||||
function outgoing() {
|
||||
return gDial(outNumber)
|
||||
.then(call => outCall = call)
|
||||
.then(() => gCheckAll(outCall, [outCall], "", [], [outInfo.ringing]))
|
||||
.then(() => is(outCall.disconnectedReason, null));
|
||||
}
|
||||
|
||||
function answer() {
|
||||
return gRemoteAnswer(outCall)
|
||||
.then(() => gCheckAll(outCall, [outCall], "", [], [outInfo.active]))
|
||||
.then(() => is(outCall.disconnectedReason, null));
|
||||
}
|
||||
|
||||
function hangUp() {
|
||||
return gHangUp(outCall)
|
||||
.then(() => gCheckAll(null, [], "", [], []))
|
||||
.then(() => is(outCall.disconnectedReason, "NormalCallClearing"));
|
||||
}
|
||||
|
||||
function remoteHangUp() {
|
||||
return gRemoteHangUp(outCall)
|
||||
.then(() => gCheckAll(null, [], "", [], []))
|
||||
.then(() => is(outCall.disconnectedReason, "NormalCallClearing"));
|
||||
}
|
||||
|
||||
function hold() {
|
||||
return gHold(outCall)
|
||||
.then(() => gCheckAll(null, [outCall], "", [], [outInfo.held]))
|
||||
.then(() => is(outCall.disconnectedReason, null));
|
||||
}
|
||||
|
||||
function resume() {
|
||||
return gResume(outCall)
|
||||
.then(() => gCheckAll(outCall, [outCall], "", [], [outInfo.active]))
|
||||
.then(() => is(outCall.disconnectedReason, null));
|
||||
}
|
||||
|
||||
// Test cases.
|
||||
|
||||
function testOutgoingReject() {
|
||||
log("= testOutgoingReject =");
|
||||
return outgoing()
|
||||
.then(() => remoteHangUp());
|
||||
}
|
||||
|
||||
function testOutgoingCancel() {
|
||||
log("= testOutgoingCancel =");
|
||||
return outgoing()
|
||||
.then(() => hangUp());
|
||||
}
|
||||
|
||||
function testOutgoingAnswerHangUp() {
|
||||
log("= testOutgoingAnswerHangUp =");
|
||||
return outgoing()
|
||||
.then(() => answer())
|
||||
.then(() => hangUp());
|
||||
}
|
||||
|
||||
function testOutgoingAnswerRemoteHangUp() {
|
||||
log("= testOutgoingAnswerRemoteHangUp =");
|
||||
return outgoing()
|
||||
.then(() => answer())
|
||||
.then(() => remoteHangUp());
|
||||
}
|
||||
|
||||
function testOutgoingAnswerHoldHangUp() {
|
||||
log("= testOutgoingAnswerHoldHangUp =");
|
||||
return outgoing()
|
||||
.then(() => answer())
|
||||
.then(() => hold())
|
||||
.then(() => hangUp());
|
||||
}
|
||||
|
||||
function testOutgoingAnswerHoldRemoteHangUp() {
|
||||
log("= testOutgoingAnswerHoldRemoteHangUp =");
|
||||
return outgoing()
|
||||
.then(() => answer())
|
||||
.then(() => hold())
|
||||
.then(() => remoteHangUp());
|
||||
}
|
||||
|
||||
function testOutgoingAnswerHoldResumeHangUp() {
|
||||
log("= testOutgoingAnswerHoldResumeHangUp =");
|
||||
return outgoing()
|
||||
.then(() => answer())
|
||||
.then(() => hold())
|
||||
.then(() => resume())
|
||||
.then(() => hangUp());
|
||||
}
|
||||
|
||||
function testOutgoingAnswerHoldResumeRemoteHangUp() {
|
||||
log("= testOutgoingAnswerHoldResumeRemoteHangUp =");
|
||||
return outgoing()
|
||||
.then(() => answer())
|
||||
.then(() => hold())
|
||||
.then(() => resume())
|
||||
.then(() => remoteHangUp());
|
||||
}
|
||||
|
||||
startTest(function() {
|
||||
Promise.resolve()
|
||||
.then(() => testOutgoingReject())
|
||||
.then(() => testOutgoingCancel())
|
||||
.then(() => testOutgoingAnswerHangUp())
|
||||
.then(() => testOutgoingAnswerRemoteHangUp())
|
||||
.then(() => testOutgoingAnswerHoldHangUp())
|
||||
.then(() => testOutgoingAnswerHoldRemoteHangUp())
|
||||
.then(() => testOutgoingAnswerHoldResumeHangUp())
|
||||
.then(() => testOutgoingAnswerHoldResumeRemoteHangUp())
|
||||
|
||||
.catch(error => ok(false, "Promise reject: " + error))
|
||||
.then(finish);
|
||||
});
|
@ -19,7 +19,7 @@ startTest(function() {
|
||||
is(event.call.error.name, "BusyError");
|
||||
is(event.call.disconnectedReason, "Busy");
|
||||
});
|
||||
let p2 = emulator.runCmd("gsm busy " + outNumber);
|
||||
let p2 = emulator.runCmd("telephony busy " + outNumber);
|
||||
return Promise.all([p1, p2]);
|
||||
})
|
||||
.then(() => gCheckAll(null, [], "", [], []))
|
||||
|
@ -18,31 +18,6 @@ class Matrix4x4;
|
||||
|
||||
namespace layers {
|
||||
|
||||
/* static */ LayersBackend Compositor::sBackend = LayersBackend::LAYERS_NONE;
|
||||
/* static */ LayersBackend
|
||||
Compositor::GetBackend()
|
||||
{
|
||||
if (sBackend != LayersBackend::LAYERS_NONE) {
|
||||
AssertOnCompositorThread();
|
||||
}
|
||||
return sBackend;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
Compositor::SetBackend(LayersBackend backend)
|
||||
{
|
||||
if (!gIsGtest && sBackend != backend &&
|
||||
sBackend != LayersBackend::LAYERS_NONE &&
|
||||
backend != LayersBackend::LAYERS_NONE) {
|
||||
// Assert this once we figure out bug 972891.
|
||||
#ifdef XP_MACOSX
|
||||
gfxWarning() << "Changing compositor from " << unsigned(sBackend) << " to " << unsigned(backend);
|
||||
#endif
|
||||
}
|
||||
|
||||
sBackend = backend;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
Compositor::AssertOnCompositorThread()
|
||||
{
|
||||
|
@ -463,16 +463,6 @@ public:
|
||||
*/
|
||||
static void AssertOnCompositorThread();
|
||||
|
||||
/**
|
||||
* We enforce that there can only be one Compositor backend type off the main
|
||||
* thread at the same time. The backend type in use can be checked with this
|
||||
* static method. We need this for creating texture clients/hosts etc. when we
|
||||
* don't have a reference to a Compositor.
|
||||
*
|
||||
* This can only be used from the compositor thread!
|
||||
*/
|
||||
static LayersBackend GetBackend();
|
||||
|
||||
size_t GetFillRatio() {
|
||||
float fillRatio = 0;
|
||||
if (mPixelsFilled > 0 && mPixelsPerFrame > 0) {
|
||||
@ -521,11 +511,6 @@ protected:
|
||||
|
||||
bool ShouldDrawDiagnostics(DiagnosticFlags);
|
||||
|
||||
/**
|
||||
* Set the global Compositor backend, checking that one isn't already set.
|
||||
*/
|
||||
static void SetBackend(LayersBackend backend);
|
||||
|
||||
/**
|
||||
* Render time for the current composition.
|
||||
*/
|
||||
|
@ -20,7 +20,7 @@ namespace layers {
|
||||
class D3D11RecycleAllocator : public TextureClientRecycleAllocator
|
||||
{
|
||||
public:
|
||||
explicit D3D11RecycleAllocator(ISurfaceAllocator* aAllocator,
|
||||
explicit D3D11RecycleAllocator(CompositableForwarder* aAllocator,
|
||||
ID3D11Device* aDevice)
|
||||
: TextureClientRecycleAllocator(aAllocator)
|
||||
, mDevice(aDevice)
|
||||
|
@ -20,7 +20,7 @@ class SharedTextureClientD3D9;
|
||||
class D3D9RecycleAllocator : public TextureClientRecycleAllocator
|
||||
{
|
||||
public:
|
||||
explicit D3D9RecycleAllocator(ISurfaceAllocator* aAllocator,
|
||||
explicit D3D9RecycleAllocator(CompositableForwarder* aAllocator,
|
||||
IDirect3DDevice9* aDevice)
|
||||
: TextureClientRecycleAllocator(aAllocator)
|
||||
, mDevice(aDevice)
|
||||
|
@ -71,7 +71,6 @@ BasicCompositor::BasicCompositor(nsIWidget *aWidget)
|
||||
: mWidget(aWidget)
|
||||
{
|
||||
MOZ_COUNT_CTOR(BasicCompositor);
|
||||
SetBackend(LayersBackend::LAYERS_BASIC);
|
||||
|
||||
mMaxTextureSize =
|
||||
Factory::GetMaxSurfaceSize(gfxPlatform::GetPlatform()->GetContentBackendFor(LayersBackend::LAYERS_BASIC));
|
||||
|
@ -285,7 +285,7 @@ TextureClient::InitIPDLActor(CompositableForwarder* aForwarder)
|
||||
return false;
|
||||
}
|
||||
|
||||
mActor = static_cast<TextureChild*>(aForwarder->CreateTexture(desc, GetFlags()));
|
||||
mActor = static_cast<TextureChild*>(aForwarder->CreateTexture(desc, aForwarder->GetCompositorBackendType(), GetFlags()));
|
||||
MOZ_ASSERT(mActor);
|
||||
mActor->mForwarder = aForwarder;
|
||||
mActor->mTextureClient = this;
|
||||
@ -358,7 +358,7 @@ BackendTypeForBackendSelector(LayersBackend aLayersBackend, BackendSelector aSel
|
||||
|
||||
// static
|
||||
already_AddRefed<TextureClient>
|
||||
TextureClient::CreateForDrawing(ISurfaceAllocator* aAllocator,
|
||||
TextureClient::CreateForDrawing(CompositableForwarder* aAllocator,
|
||||
gfx::SurfaceFormat aFormat,
|
||||
gfx::IntSize aSize,
|
||||
BackendSelector aSelector,
|
||||
|
@ -178,7 +178,7 @@ public:
|
||||
|
||||
// Creates and allocates a TextureClient usable with Moz2D.
|
||||
static already_AddRefed<TextureClient>
|
||||
CreateForDrawing(ISurfaceAllocator* aAllocator,
|
||||
CreateForDrawing(CompositableForwarder* aAllocator,
|
||||
gfx::SurfaceFormat aFormat,
|
||||
gfx::IntSize aSize,
|
||||
BackendSelector aSelector,
|
||||
|
@ -27,7 +27,7 @@ TextureClientPool::TextureClientPool(gfx::SurfaceFormat aFormat,
|
||||
gfx::IntSize aSize,
|
||||
uint32_t aMaxTextureClients,
|
||||
uint32_t aShrinkTimeoutMsec,
|
||||
ISurfaceAllocator *aAllocator)
|
||||
CompositableForwarder* aAllocator)
|
||||
: mFormat(aFormat)
|
||||
, mSize(aSize)
|
||||
, mMaxTextureClients(aMaxTextureClients)
|
||||
|
@ -17,6 +17,7 @@ namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
class ISurfaceAllocator;
|
||||
class CompositableForwarder;
|
||||
|
||||
class TextureClientAllocator
|
||||
{
|
||||
@ -44,7 +45,7 @@ public:
|
||||
TextureClientPool(gfx::SurfaceFormat aFormat, gfx::IntSize aSize,
|
||||
uint32_t aMaxTextureClients,
|
||||
uint32_t aShrinkTimeoutMsec,
|
||||
ISurfaceAllocator *aAllocator);
|
||||
CompositableForwarder* aAllocator);
|
||||
|
||||
/**
|
||||
* Gets an allocated TextureClient of size and format that are determined
|
||||
@ -131,7 +132,7 @@ private:
|
||||
std::stack<RefPtr<TextureClient> > mTextureClients;
|
||||
std::stack<RefPtr<TextureClient> > mTextureClientsDeferred;
|
||||
nsRefPtr<nsITimer> mTimer;
|
||||
RefPtr<ISurfaceAllocator> mSurfaceAllocator;
|
||||
RefPtr<CompositableForwarder> mSurfaceAllocator;
|
||||
};
|
||||
|
||||
} // namespace layers
|
||||
|
@ -31,7 +31,7 @@ protected:
|
||||
RefPtr<TextureClient> mTextureClient;
|
||||
};
|
||||
|
||||
TextureClientRecycleAllocator::TextureClientRecycleAllocator(ISurfaceAllocator *aAllocator)
|
||||
TextureClientRecycleAllocator::TextureClientRecycleAllocator(CompositableForwarder* aAllocator)
|
||||
: mSurfaceAllocator(aAllocator)
|
||||
, mMaxPooledSize(kMaxPooledSized)
|
||||
, mLock("TextureClientRecycleAllocatorImp.mLock")
|
||||
|
@ -37,7 +37,7 @@ protected:
|
||||
public:
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(TextureClientRecycleAllocator)
|
||||
|
||||
explicit TextureClientRecycleAllocator(ISurfaceAllocator* aAllocator);
|
||||
explicit TextureClientRecycleAllocator(CompositableForwarder* aAllocator);
|
||||
|
||||
void SetMaxPoolSize(uint32_t aMax);
|
||||
|
||||
@ -57,7 +57,7 @@ protected:
|
||||
TextureFlags aTextureFlags,
|
||||
TextureAllocationFlags aAllocFlags);
|
||||
|
||||
RefPtr<ISurfaceAllocator> mSurfaceAllocator;
|
||||
RefPtr<CompositableForwarder> mSurfaceAllocator;
|
||||
|
||||
private:
|
||||
friend class TextureClient;
|
||||
|
@ -161,7 +161,7 @@ LayerManagerComposite::UpdateRenderBounds(const IntRect& aRect)
|
||||
bool
|
||||
LayerManagerComposite::AreComponentAlphaLayersEnabled()
|
||||
{
|
||||
return Compositor::GetBackend() != LayersBackend::LAYERS_BASIC &&
|
||||
return mCompositor->GetBackendType() != LayersBackend::LAYERS_BASIC &&
|
||||
LayerManager::AreComponentAlphaLayersEnabled();
|
||||
}
|
||||
|
||||
|
@ -69,6 +69,7 @@ public:
|
||||
~TextureParent();
|
||||
|
||||
bool Init(const SurfaceDescriptor& aSharedData,
|
||||
const LayersBackend& aLayersBackend,
|
||||
const TextureFlags& aFlags);
|
||||
|
||||
void CompositorRecycle();
|
||||
@ -93,11 +94,10 @@ public:
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// static
|
||||
PTextureParent*
|
||||
TextureHost::CreateIPDLActor(CompositableParentManager* aManager,
|
||||
const SurfaceDescriptor& aSharedData,
|
||||
LayersBackend aLayersBackend,
|
||||
TextureFlags aFlags)
|
||||
{
|
||||
if (aSharedData.type() == SurfaceDescriptor::TSurfaceDescriptorMemory &&
|
||||
@ -107,7 +107,7 @@ TextureHost::CreateIPDLActor(CompositableParentManager* aManager,
|
||||
return nullptr;
|
||||
}
|
||||
TextureParent* actor = new TextureParent(aManager);
|
||||
if (!actor->Init(aSharedData, aFlags)) {
|
||||
if (!actor->Init(aSharedData, aLayersBackend, aFlags)) {
|
||||
delete actor;
|
||||
return nullptr;
|
||||
}
|
||||
@ -200,10 +200,10 @@ already_AddRefed<TextureHost> CreateTextureHostD3D9(const SurfaceDescriptor& aDe
|
||||
ISurfaceAllocator* aDeallocator,
|
||||
TextureFlags aFlags);
|
||||
|
||||
// static
|
||||
already_AddRefed<TextureHost>
|
||||
TextureHost::Create(const SurfaceDescriptor& aDesc,
|
||||
ISurfaceAllocator* aDeallocator,
|
||||
LayersBackend aBackend,
|
||||
TextureFlags aFlags)
|
||||
{
|
||||
switch (aDesc.type()) {
|
||||
@ -219,7 +219,7 @@ TextureHost::Create(const SurfaceDescriptor& aDesc,
|
||||
return CreateTextureHostOGL(aDesc, aDeallocator, aFlags);
|
||||
|
||||
case SurfaceDescriptor::TSurfaceDescriptorMacIOSurface:
|
||||
if (Compositor::GetBackend() == LayersBackend::LAYERS_OPENGL) {
|
||||
if (aBackend == LayersBackend::LAYERS_OPENGL) {
|
||||
return CreateTextureHostOGL(aDesc, aDeallocator, aFlags);
|
||||
} else {
|
||||
return CreateTextureHostBasic(aDesc, aDeallocator, aFlags);
|
||||
@ -238,7 +238,7 @@ TextureHost::Create(const SurfaceDescriptor& aDesc,
|
||||
|
||||
case SurfaceDescriptor::TSurfaceDescriptorD3D10:
|
||||
case SurfaceDescriptor::TSurfaceDescriptorDXGIYCbCr:
|
||||
if (Compositor::GetBackend() == LayersBackend::LAYERS_D3D9) {
|
||||
if (aBackend == LayersBackend::LAYERS_D3D9) {
|
||||
return CreateTextureHostD3D9(aDesc, aDeallocator, aFlags);
|
||||
} else {
|
||||
return CreateTextureHostD3D11(aDesc, aDeallocator, aFlags);
|
||||
@ -798,10 +798,12 @@ TextureParent::RecvClientRecycle()
|
||||
|
||||
bool
|
||||
TextureParent::Init(const SurfaceDescriptor& aSharedData,
|
||||
const LayersBackend& aBackend,
|
||||
const TextureFlags& aFlags)
|
||||
{
|
||||
mTextureHost = TextureHost::Create(aSharedData,
|
||||
mCompositableManager,
|
||||
aBackend,
|
||||
aFlags);
|
||||
if (mTextureHost) {
|
||||
mTextureHost->mActor = this;
|
||||
|
@ -325,9 +325,11 @@ public:
|
||||
/**
|
||||
* Factory method.
|
||||
*/
|
||||
static already_AddRefed<TextureHost> Create(const SurfaceDescriptor& aDesc,
|
||||
ISurfaceAllocator* aDeallocator,
|
||||
TextureFlags aFlags);
|
||||
static already_AddRefed<TextureHost> Create(
|
||||
const SurfaceDescriptor& aDesc,
|
||||
ISurfaceAllocator* aDeallocator,
|
||||
LayersBackend aBackend,
|
||||
TextureFlags aFlags);
|
||||
|
||||
/**
|
||||
* Tell to TextureChild that TextureHost is recycled.
|
||||
@ -450,6 +452,7 @@ public:
|
||||
*/
|
||||
static PTextureParent* CreateIPDLActor(CompositableParentManager* aManager,
|
||||
const SurfaceDescriptor& aSharedData,
|
||||
LayersBackend aLayersBackend,
|
||||
TextureFlags aFlags);
|
||||
static bool DestroyIPDLActor(PTextureParent* actor);
|
||||
|
||||
|
@ -121,7 +121,7 @@ private:
|
||||
if (!mInitOkay) {
|
||||
return;
|
||||
}
|
||||
if (FAILED(mDevice->CreateVertexShader(aShader.mData, aShader.mLength, nullptr, aOut))) {
|
||||
if (Failed(mDevice->CreateVertexShader(aShader.mData, aShader.mLength, nullptr, aOut), "create vs")) {
|
||||
mInitOkay = false;
|
||||
}
|
||||
}
|
||||
@ -129,11 +129,20 @@ private:
|
||||
if (!mInitOkay) {
|
||||
return;
|
||||
}
|
||||
if (FAILED(mDevice->CreatePixelShader(aShader.mData, aShader.mLength, nullptr, aOut))) {
|
||||
if (Failed(mDevice->CreatePixelShader(aShader.mData, aShader.mLength, nullptr, aOut), "create ps")) {
|
||||
mInitOkay = false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Failed(HRESULT hr, const char* aContext) {
|
||||
if (SUCCEEDED(hr))
|
||||
return false;
|
||||
|
||||
gfxCriticalError(CriticalLog::DefaultOptions(false))
|
||||
<< "[D3D11] " << aContext << " failed: " << hexa(hr);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Only used during initialization.
|
||||
RefPtr<ID3D11Device> mDevice;
|
||||
bool mInitOkay;
|
||||
@ -145,7 +154,6 @@ CompositorD3D11::CompositorD3D11(nsIWidget* aWidget)
|
||||
, mHwnd(nullptr)
|
||||
, mDisableSequenceForNextFrame(false)
|
||||
{
|
||||
SetBackend(LayersBackend::LAYERS_D3D11);
|
||||
}
|
||||
|
||||
CompositorD3D11::~CompositorD3D11()
|
||||
@ -193,6 +201,8 @@ CompositorD3D11::Initialize()
|
||||
mDevice->GetImmediateContext(byRef(mContext));
|
||||
|
||||
if (!mContext) {
|
||||
gfxCriticalError(CriticalLog::DefaultOptions(false))
|
||||
<< "[D3D11] failed to get immediate context";
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -231,7 +241,7 @@ CompositorD3D11::Initialize()
|
||||
sizeof(LayerQuadVS),
|
||||
byRef(mAttachments->mInputLayout));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
if (Failed(hr, "CreateInputLayout")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -242,7 +252,7 @@ CompositorD3D11::Initialize()
|
||||
|
||||
hr = mDevice->CreateBuffer(&bufferDesc, &data, byRef(mAttachments->mVertexBuffer));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
if (Failed(hr, "create vertex buffer")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -256,13 +266,13 @@ CompositorD3D11::Initialize()
|
||||
D3D11_CPU_ACCESS_WRITE);
|
||||
|
||||
hr = mDevice->CreateBuffer(&cBufferDesc, nullptr, byRef(mAttachments->mVSConstantBuffer));
|
||||
if (FAILED(hr)) {
|
||||
if (Failed(hr, "create vs buffer")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
cBufferDesc.ByteWidth = sizeof(PixelShaderConstants);
|
||||
hr = mDevice->CreateBuffer(&cBufferDesc, nullptr, byRef(mAttachments->mPSConstantBuffer));
|
||||
if (FAILED(hr)) {
|
||||
if (Failed(hr, "create ps buffer")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -271,19 +281,19 @@ CompositorD3D11::Initialize()
|
||||
rastDesc.ScissorEnable = TRUE;
|
||||
|
||||
hr = mDevice->CreateRasterizerState(&rastDesc, byRef(mAttachments->mRasterizerState));
|
||||
if (FAILED(hr)) {
|
||||
if (Failed(hr, "create rasterizer")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
CD3D11_SAMPLER_DESC samplerDesc(D3D11_DEFAULT);
|
||||
hr = mDevice->CreateSamplerState(&samplerDesc, byRef(mAttachments->mLinearSamplerState));
|
||||
if (FAILED(hr)) {
|
||||
if (Failed(hr, "create linear sampler")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
|
||||
hr = mDevice->CreateSamplerState(&samplerDesc, byRef(mAttachments->mPointSamplerState));
|
||||
if (FAILED(hr)) {
|
||||
if (Failed(hr, "create point sampler")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -296,7 +306,7 @@ CompositorD3D11::Initialize()
|
||||
};
|
||||
blendDesc.RenderTarget[0] = rtBlendPremul;
|
||||
hr = mDevice->CreateBlendState(&blendDesc, byRef(mAttachments->mPremulBlendState));
|
||||
if (FAILED(hr)) {
|
||||
if (Failed(hr, "create pm blender")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -308,7 +318,7 @@ CompositorD3D11::Initialize()
|
||||
};
|
||||
blendDesc.RenderTarget[0] = rtBlendMultiplyPremul;
|
||||
hr = mDevice->CreateBlendState(&blendDesc, byRef(mAttachments->mPremulBlendMultiplyState));
|
||||
if (FAILED(hr)) {
|
||||
if (Failed(hr, "create pm-mul blender")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -320,7 +330,7 @@ CompositorD3D11::Initialize()
|
||||
};
|
||||
blendDesc.RenderTarget[0] = rtBlendScreenPremul;
|
||||
hr = mDevice->CreateBlendState(&blendDesc, byRef(mAttachments->mPremulBlendScreenState));
|
||||
if (FAILED(hr)) {
|
||||
if (Failed(hr, "create pm-scn blender")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -332,7 +342,7 @@ CompositorD3D11::Initialize()
|
||||
};
|
||||
blendDesc.RenderTarget[0] = rtBlendNonPremul;
|
||||
hr = mDevice->CreateBlendState(&blendDesc, byRef(mAttachments->mNonPremulBlendState));
|
||||
if (FAILED(hr)) {
|
||||
if (Failed(hr, "create npm blender")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -349,7 +359,7 @@ CompositorD3D11::Initialize()
|
||||
};
|
||||
blendDesc.RenderTarget[0] = rtBlendComponent;
|
||||
hr = mDevice->CreateBlendState(&blendDesc, byRef(mAttachments->mComponentBlendState));
|
||||
if (FAILED(hr)) {
|
||||
if (Failed(hr, "create component blender")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -362,7 +372,7 @@ CompositorD3D11::Initialize()
|
||||
};
|
||||
blendDesc.RenderTarget[0] = rtBlendDisabled;
|
||||
hr = mDevice->CreateBlendState(&blendDesc, byRef(mAttachments->mDisabledBlendState));
|
||||
if (FAILED(hr)) {
|
||||
if (Failed(hr, "create null blender")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -394,7 +404,7 @@ CompositorD3D11::Initialize()
|
||||
|
||||
cBufferDesc.ByteWidth = sizeof(gfx::VRDistortionConstants);
|
||||
hr = mDevice->CreateBuffer(&cBufferDesc, nullptr, byRef(mAttachments->mVRDistortionConstants));
|
||||
if (FAILED(hr)) {
|
||||
if (Failed(hr, "create vr buffer ")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -432,7 +442,7 @@ CompositorD3D11::Initialize()
|
||||
* buffer.
|
||||
*/
|
||||
hr = dxgiFactory->CreateSwapChain(dxgiDevice, &swapDesc, byRef(mSwapChain));
|
||||
if (FAILED(hr)) {
|
||||
if (Failed(hr, "create swap chain")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1353,12 +1363,12 @@ DeviceAttachmentsD3D11::InitSyncObject()
|
||||
|
||||
RefPtr<ID3D11Texture2D> texture;
|
||||
HRESULT hr = mDevice->CreateTexture2D(&desc, nullptr, byRef(texture));
|
||||
if (FAILED(hr)) {
|
||||
if (Failed(hr, "create sync texture")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
hr = texture->QueryInterface((IDXGIResource**)byRef(mSyncTexture));
|
||||
if (FAILED(hr)) {
|
||||
if (Failed(hr, "QI sync texture")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1508,6 +1518,17 @@ CompositorD3D11::PaintToTarget()
|
||||
mContext->Unmap(readTexture, 0);
|
||||
}
|
||||
|
||||
bool
|
||||
CompositorD3D11::Failed(HRESULT hr, const char* aContext)
|
||||
{
|
||||
if (SUCCEEDED(hr))
|
||||
return false;
|
||||
|
||||
gfxCriticalError(CriticalLog::DefaultOptions(false))
|
||||
<< "[D3D11] " << aContext << " failed: " << hexa(hr);
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
CompositorD3D11::HandleError(HRESULT hr, Severity aSeverity)
|
||||
{
|
||||
|
@ -160,6 +160,10 @@ private:
|
||||
bool Failed(HRESULT hr, Severity aSeverity = DebugAssert);
|
||||
bool Succeeded(HRESULT hr, Severity aSeverity = DebugAssert);
|
||||
|
||||
// Same as Failed(), except the severity is critical (with no abort) and
|
||||
// a string prefix must be provided.
|
||||
bool Failed(HRESULT hr, const char* aContext);
|
||||
|
||||
// ensure mSize is up to date with respect to mWidget
|
||||
void EnsureSize();
|
||||
bool VerifyBufferSize();
|
||||
|
@ -29,7 +29,6 @@ CompositorD3D9::CompositorD3D9(PCompositorParent* aParent, nsIWidget *aWidget)
|
||||
, mDeviceResetCount(0)
|
||||
, mFailedResetAttempts(0)
|
||||
{
|
||||
Compositor::SetBackend(LayersBackend::LAYERS_D3D9);
|
||||
}
|
||||
|
||||
CompositorD3D9::~CompositorD3D9()
|
||||
|
@ -64,7 +64,10 @@ public:
|
||||
/**
|
||||
* Create a TextureChild/Parent pair as as well as the TextureHost on the parent side.
|
||||
*/
|
||||
virtual PTextureChild* CreateTexture(const SurfaceDescriptor& aSharedData, TextureFlags aFlags) = 0;
|
||||
virtual PTextureChild* CreateTexture(
|
||||
const SurfaceDescriptor& aSharedData,
|
||||
LayersBackend aLayersBackend,
|
||||
TextureFlags aFlags) = 0;
|
||||
|
||||
/**
|
||||
* Communicate to the compositor that aRegion in the texture identified by
|
||||
@ -166,7 +169,7 @@ public:
|
||||
* We only don't allow changing the backend type at runtime so this value can
|
||||
* be queried once and will not change until Gecko is restarted.
|
||||
*/
|
||||
virtual LayersBackend GetCompositorBackendType() const override
|
||||
LayersBackend GetCompositorBackendType() const
|
||||
{
|
||||
return mTextureFactoryIdentifier.mParentBackend;
|
||||
}
|
||||
|
@ -83,16 +83,6 @@ public:
|
||||
|
||||
void Finalize();
|
||||
|
||||
/**
|
||||
* Returns the type of backend that is used off the main thread.
|
||||
* We only don't allow changing the backend type at runtime so this value can
|
||||
* be queried once and will not change until Gecko is restarted.
|
||||
*
|
||||
* XXX - With e10s this may not be true anymore. we can have accelerated widgets
|
||||
* and non-accelerated widgets (small popups, etc.)
|
||||
*/
|
||||
virtual LayersBackend GetCompositorBackendType() const = 0;
|
||||
|
||||
/**
|
||||
* Allocate shared memory that can be accessed by only one process at a time.
|
||||
* Ownership of this memory is passed when the memory is sent in an IPDL
|
||||
|
@ -856,6 +856,7 @@ ImageBridgeChild::DeallocShmem(ipc::Shmem& aShmem)
|
||||
|
||||
PTextureChild*
|
||||
ImageBridgeChild::AllocPTextureChild(const SurfaceDescriptor&,
|
||||
const LayersBackend&,
|
||||
const TextureFlags&)
|
||||
{
|
||||
MOZ_ASSERT(!mShuttingDown);
|
||||
@ -951,10 +952,11 @@ ImageBridgeChild::RecvDidComposite(InfallibleTArray<ImageCompositeNotification>&
|
||||
|
||||
PTextureChild*
|
||||
ImageBridgeChild::CreateTexture(const SurfaceDescriptor& aSharedData,
|
||||
LayersBackend aLayersBackend,
|
||||
TextureFlags aFlags)
|
||||
{
|
||||
MOZ_ASSERT(!mShuttingDown);
|
||||
return SendPTextureConstructor(aSharedData, aFlags);
|
||||
return SendPTextureConstructor(aSharedData, aLayersBackend, aFlags);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -185,7 +185,7 @@ public:
|
||||
~ImageBridgeChild();
|
||||
|
||||
virtual PTextureChild*
|
||||
AllocPTextureChild(const SurfaceDescriptor& aSharedData, const TextureFlags& aFlags) override;
|
||||
AllocPTextureChild(const SurfaceDescriptor& aSharedData, const LayersBackend& aLayersBackend, const TextureFlags& aFlags) override;
|
||||
|
||||
virtual bool
|
||||
DeallocPTextureChild(PTextureChild* actor) override;
|
||||
@ -292,6 +292,7 @@ public:
|
||||
virtual void DeallocShmem(mozilla::ipc::Shmem& aShmem) override;
|
||||
|
||||
virtual PTextureChild* CreateTexture(const SurfaceDescriptor& aSharedData,
|
||||
LayersBackend aLayersBackend,
|
||||
TextureFlags aFlags) override;
|
||||
|
||||
virtual bool IsSameProcess() const override;
|
||||
|
@ -91,12 +91,6 @@ ImageBridgeParent::~ImageBridgeParent()
|
||||
sImageBridges.erase(OtherPid());
|
||||
}
|
||||
|
||||
LayersBackend
|
||||
ImageBridgeParent::GetCompositorBackendType() const
|
||||
{
|
||||
return Compositor::GetBackend();
|
||||
}
|
||||
|
||||
void
|
||||
ImageBridgeParent::ActorDestroy(ActorDestroyReason aWhy)
|
||||
{
|
||||
@ -138,12 +132,6 @@ ImageBridgeParent::RecvUpdate(EditArray&& aEdits, EditReplyArray* aReply)
|
||||
{
|
||||
AutoImageBridgeParentAsyncMessageSender autoAsyncMessageSender(this);
|
||||
|
||||
// If we don't actually have a compositor, then don't bother
|
||||
// creating any textures.
|
||||
if (Compositor::GetBackend() == LayersBackend::LAYERS_NONE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
EditReplyVector replyv;
|
||||
for (EditArray::index_type i = 0; i < aEdits.Length(); ++i) {
|
||||
if (!ReceiveCompositableUpdate(aEdits[i], replyv)) {
|
||||
@ -256,9 +244,10 @@ bool ImageBridgeParent::DeallocPCompositableParent(PCompositableParent* aActor)
|
||||
|
||||
PTextureParent*
|
||||
ImageBridgeParent::AllocPTextureParent(const SurfaceDescriptor& aSharedData,
|
||||
const LayersBackend& aLayersBackend,
|
||||
const TextureFlags& aFlags)
|
||||
{
|
||||
return TextureHost::CreateIPDLActor(this, aSharedData, aFlags);
|
||||
return TextureHost::CreateIPDLActor(this, aSharedData, aLayersBackend, aFlags);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -49,8 +49,6 @@ public:
|
||||
ImageBridgeParent(MessageLoop* aLoop, Transport* aTransport, ProcessId aChildProcessId);
|
||||
~ImageBridgeParent();
|
||||
|
||||
virtual LayersBackend GetCompositorBackendType() const override;
|
||||
|
||||
virtual void ActorDestroy(ActorDestroyReason aWhy) override;
|
||||
|
||||
static PImageBridgeParent*
|
||||
@ -80,6 +78,7 @@ public:
|
||||
bool DeallocPCompositableParent(PCompositableParent* aActor) override;
|
||||
|
||||
virtual PTextureParent* AllocPTextureParent(const SurfaceDescriptor& aSharedData,
|
||||
const LayersBackend& aLayersBackend,
|
||||
const TextureFlags& aFlags) override;
|
||||
virtual bool DeallocPTextureParent(PTextureParent* actor) override;
|
||||
|
||||
|
@ -126,6 +126,7 @@ LayerTransactionChild::ActorDestroy(ActorDestroyReason why)
|
||||
|
||||
PTextureChild*
|
||||
LayerTransactionChild::AllocPTextureChild(const SurfaceDescriptor&,
|
||||
const LayersBackend&,
|
||||
const TextureFlags&)
|
||||
{
|
||||
MOZ_ASSERT(!mDestroyed);
|
||||
|
@ -65,6 +65,7 @@ protected:
|
||||
virtual bool DeallocPCompositableChild(PCompositableChild* actor) override;
|
||||
|
||||
virtual PTextureChild* AllocPTextureChild(const SurfaceDescriptor& aSharedData,
|
||||
const LayersBackend& aLayersBackend,
|
||||
const TextureFlags& aFlags) override;
|
||||
virtual bool DeallocPTextureChild(PTextureChild* actor) override;
|
||||
|
||||
|
@ -182,12 +182,6 @@ LayerTransactionParent::Destroy()
|
||||
}
|
||||
}
|
||||
|
||||
LayersBackend
|
||||
LayerTransactionParent::GetCompositorBackendType() const
|
||||
{
|
||||
return mLayerManager->GetBackendType();
|
||||
}
|
||||
|
||||
bool
|
||||
LayerTransactionParent::RecvUpdateNoSwap(InfallibleTArray<Edit>&& cset,
|
||||
const uint64_t& aTransactionId,
|
||||
@ -924,9 +918,11 @@ LayerTransactionParent::DeallocPCompositableParent(PCompositableParent* aActor)
|
||||
|
||||
PTextureParent*
|
||||
LayerTransactionParent::AllocPTextureParent(const SurfaceDescriptor& aSharedData,
|
||||
const LayersBackend& aLayersBackend,
|
||||
const TextureFlags& aFlags)
|
||||
{
|
||||
return TextureHost::CreateIPDLActor(this, aSharedData, aFlags);
|
||||
MOZ_ASSERT(aLayersBackend == mLayerManager->GetCompositor()->GetBackendType());
|
||||
return TextureHost::CreateIPDLActor(this, aSharedData, aLayersBackend, aFlags);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -78,8 +78,6 @@ public:
|
||||
PLayerTransactionParent::DeallocShmem(aShmem);
|
||||
}
|
||||
|
||||
virtual LayersBackend GetCompositorBackendType() const override;
|
||||
|
||||
virtual bool IsSameProcess() const override;
|
||||
|
||||
const uint64_t& GetPendingTransactionId() { return mPendingTransaction; }
|
||||
@ -150,6 +148,7 @@ protected:
|
||||
virtual bool DeallocPCompositableParent(PCompositableParent* actor) override;
|
||||
|
||||
virtual PTextureParent* AllocPTextureParent(const SurfaceDescriptor& aSharedData,
|
||||
const LayersBackend& aLayersBackend,
|
||||
const TextureFlags& aFlags) override;
|
||||
virtual bool DeallocPTextureParent(PTextureParent* actor) override;
|
||||
|
||||
|
@ -42,6 +42,7 @@ using mozilla::layers::DiagnosticTypes from "mozilla/layers/CompositorTypes.h";
|
||||
using struct mozilla::layers::FrameMetrics from "FrameMetrics.h";
|
||||
using mozilla::layers::FrameMetrics::ViewID from "FrameMetrics.h";
|
||||
using struct mozilla::layers::FenceHandle from "mozilla/layers/FenceUtils.h";
|
||||
using mozilla::layers::LayersBackend from "mozilla/layers/LayersTypes.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
@ -59,7 +59,7 @@ parent:
|
||||
|
||||
sync PCompositable(TextureInfo aInfo,
|
||||
PImageContainer aImageContainer) returns (uint64_t id);
|
||||
async PTexture(SurfaceDescriptor aSharedData, TextureFlags aTextureFlags);
|
||||
async PTexture(SurfaceDescriptor aSharedData, LayersBackend aBackend, TextureFlags aTextureFlags);
|
||||
async PMediaSystemResourceManager();
|
||||
async PImageContainer();
|
||||
|
||||
|
@ -21,6 +21,7 @@ using mozilla::layers::TextureFlags from "mozilla/layers/CompositorTypes.h";
|
||||
using class mozilla::layers::APZTestData from "mozilla/layers/APZTestData.h";
|
||||
using mozilla::layers::FrameMetrics::ViewID from "FrameMetrics.h";
|
||||
using struct mozilla::layers::ScrollableLayerGuid from "FrameMetrics.h";
|
||||
using mozilla::layers::LayersBackend from "mozilla/layers/LayersTypes.h";
|
||||
|
||||
/**
|
||||
* The layers protocol is spoken between thread contexts that manage
|
||||
@ -50,7 +51,7 @@ child:
|
||||
parent:
|
||||
async PLayer();
|
||||
async PCompositable(TextureInfo aTextureInfo);
|
||||
async PTexture(SurfaceDescriptor aSharedData, TextureFlags aTextureFlags);
|
||||
async PTexture(SurfaceDescriptor aSharedData, LayersBackend aBackend, TextureFlags aTextureFlags);
|
||||
|
||||
// The isFirstPaint flag can be used to indicate that this is the first update
|
||||
// for a particular document.
|
||||
|
@ -816,13 +816,14 @@ void ShadowLayerForwarder::AttachAsyncCompositable(uint64_t aCompositableID,
|
||||
|
||||
PTextureChild*
|
||||
ShadowLayerForwarder::CreateTexture(const SurfaceDescriptor& aSharedData,
|
||||
LayersBackend aLayersBackend,
|
||||
TextureFlags aFlags)
|
||||
{
|
||||
if (!HasShadowManager() ||
|
||||
!mShadowManager->IPCOpen()) {
|
||||
return nullptr;
|
||||
}
|
||||
return mShadowManager->SendPTextureConstructor(aSharedData, aFlags);
|
||||
return mShadowManager->SendPTextureConstructor(aSharedData, aLayersBackend, aFlags);
|
||||
}
|
||||
|
||||
|
||||
|
@ -128,6 +128,7 @@ public:
|
||||
ImageContainer* aImageContainer) override;
|
||||
|
||||
virtual PTextureChild* CreateTexture(const SurfaceDescriptor& aSharedData,
|
||||
LayersBackend aLayersBackend,
|
||||
TextureFlags aFlags) override;
|
||||
|
||||
/**
|
||||
|
@ -92,7 +92,6 @@ CompositorOGL::CompositorOGL(nsIWidget *aWidget, int aSurfaceWidth,
|
||||
, mCurrentProgram(nullptr)
|
||||
{
|
||||
MOZ_COUNT_CTOR(CompositorOGL);
|
||||
SetBackend(LayersBackend::LAYERS_OPENGL);
|
||||
}
|
||||
|
||||
CompositorOGL::~CompositorOGL()
|
||||
|
@ -62,8 +62,7 @@ private:
|
||||
/* static */ GLManager*
|
||||
GLManager::CreateGLManager(LayerManagerComposite* aManager)
|
||||
{
|
||||
if (aManager &&
|
||||
Compositor::GetBackend() == LayersBackend::LAYERS_OPENGL) {
|
||||
if (aManager && aManager->GetCompositor()->GetBackendType() == LayersBackend::LAYERS_OPENGL) {
|
||||
return new GLManagerCompositor(static_cast<CompositorOGL*>(
|
||||
aManager->GetCompositor()));
|
||||
}
|
||||
|
@ -82,30 +82,6 @@ inline GraphicsFilter ThebesFilter(Filter aFilter)
|
||||
}
|
||||
}
|
||||
|
||||
inline ExtendMode ToExtendMode(gfxPattern::GraphicsExtend aExtend)
|
||||
{
|
||||
switch (aExtend) {
|
||||
case gfxPattern::EXTEND_REPEAT:
|
||||
return ExtendMode::REPEAT;
|
||||
case gfxPattern::EXTEND_REFLECT:
|
||||
return ExtendMode::REFLECT;
|
||||
default:
|
||||
return ExtendMode::CLAMP;
|
||||
}
|
||||
}
|
||||
|
||||
inline gfxPattern::GraphicsExtend ThebesExtend(ExtendMode aExtend)
|
||||
{
|
||||
switch (aExtend) {
|
||||
case ExtendMode::REPEAT:
|
||||
return gfxPattern::EXTEND_REPEAT;
|
||||
case ExtendMode::REFLECT:
|
||||
return gfxPattern::EXTEND_REFLECT;
|
||||
default:
|
||||
return gfxPattern::EXTEND_PAD;
|
||||
}
|
||||
}
|
||||
|
||||
inline gfxPoint ThebesPoint(const Point &aPoint)
|
||||
{
|
||||
return gfxPoint(aPoint.x, aPoint.y);
|
||||
|
@ -20,14 +20,14 @@
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
gfxPattern::gfxPattern(const Color& aColor)
|
||||
: mExtend(EXTEND_NONE)
|
||||
: mExtend(ExtendMode::CLAMP)
|
||||
{
|
||||
mGfxPattern.InitColorPattern(ToDeviceColor(aColor));
|
||||
}
|
||||
|
||||
// linear
|
||||
gfxPattern::gfxPattern(gfxFloat x0, gfxFloat y0, gfxFloat x1, gfxFloat y1)
|
||||
: mExtend(EXTEND_NONE)
|
||||
: mExtend(ExtendMode::CLAMP)
|
||||
{
|
||||
mGfxPattern.InitLinearGradientPattern(Point(x0, y0), Point(x1, y1), nullptr);
|
||||
}
|
||||
@ -35,7 +35,7 @@ gfxPattern::gfxPattern(gfxFloat x0, gfxFloat y0, gfxFloat x1, gfxFloat y1)
|
||||
// radial
|
||||
gfxPattern::gfxPattern(gfxFloat cx0, gfxFloat cy0, gfxFloat radius0,
|
||||
gfxFloat cx1, gfxFloat cy1, gfxFloat radius1)
|
||||
: mExtend(EXTEND_NONE)
|
||||
: mExtend(ExtendMode::CLAMP)
|
||||
{
|
||||
mGfxPattern.InitRadialGradientPattern(Point(cx0, cy0), Point(cx1, cy1),
|
||||
radius0, radius1, nullptr);
|
||||
@ -44,9 +44,9 @@ gfxPattern::gfxPattern(gfxFloat cx0, gfxFloat cy0, gfxFloat radius0,
|
||||
// Azure
|
||||
gfxPattern::gfxPattern(SourceSurface *aSurface, const Matrix &aPatternToUserSpace)
|
||||
: mPatternToUserSpace(aPatternToUserSpace)
|
||||
, mExtend(EXTEND_NONE)
|
||||
, mExtend(ExtendMode::CLAMP)
|
||||
{
|
||||
mGfxPattern.InitSurfacePattern(aSurface, ToExtendMode(mExtend), Matrix(), // matrix is overridden in GetPattern()
|
||||
mGfxPattern.InitSurfacePattern(aSurface, mExtend, Matrix(), // matrix is overridden in GetPattern()
|
||||
mozilla::gfx::Filter::GOOD);
|
||||
}
|
||||
|
||||
@ -75,8 +75,7 @@ gfxPattern::SetColorStops(GradientStops* aStops)
|
||||
void
|
||||
gfxPattern::CacheColorStops(const DrawTarget *aDT)
|
||||
{
|
||||
mStops = gfxGradientCache::GetOrCreateGradientStops(aDT, mStopsList,
|
||||
ToExtendMode(mExtend));
|
||||
mStops = gfxGradientCache::GetOrCreateGradientStops(aDT, mStopsList, mExtend);
|
||||
}
|
||||
|
||||
void
|
||||
@ -132,15 +131,14 @@ gfxPattern::GetPattern(const DrawTarget *aTarget,
|
||||
if (!mStops &&
|
||||
!mStopsList.IsEmpty()) {
|
||||
mStops = aTarget->CreateGradientStops(mStopsList.Elements(),
|
||||
mStopsList.Length(),
|
||||
ToExtendMode(mExtend));
|
||||
mStopsList.Length(), mExtend);
|
||||
}
|
||||
|
||||
switch (mGfxPattern.GetPattern()->GetType()) {
|
||||
case PatternType::SURFACE: {
|
||||
SurfacePattern* surfacePattern = static_cast<SurfacePattern*>(mGfxPattern.GetPattern());
|
||||
surfacePattern->mMatrix = patternToUser;
|
||||
surfacePattern->mExtendMode = ToExtendMode(mExtend);
|
||||
surfacePattern->mExtendMode = mExtend;
|
||||
break;
|
||||
}
|
||||
case PatternType::LINEAR_GRADIENT: {
|
||||
@ -164,9 +162,9 @@ gfxPattern::GetPattern(const DrawTarget *aTarget,
|
||||
}
|
||||
|
||||
void
|
||||
gfxPattern::SetExtend(GraphicsExtend extend)
|
||||
gfxPattern::SetExtend(ExtendMode aExtend)
|
||||
{
|
||||
mExtend = extend;
|
||||
mExtend = aExtend;
|
||||
mStops = nullptr;
|
||||
}
|
||||
|
||||
@ -183,12 +181,6 @@ gfxPattern::IsOpaque()
|
||||
return false;
|
||||
}
|
||||
|
||||
gfxPattern::GraphicsExtend
|
||||
gfxPattern::Extend() const
|
||||
{
|
||||
return mExtend;
|
||||
}
|
||||
|
||||
void
|
||||
gfxPattern::SetFilter(GraphicsFilter filter)
|
||||
{
|
||||
|
@ -53,26 +53,8 @@ public:
|
||||
mozilla::gfx::Matrix *aOriginalUserToDevice = nullptr);
|
||||
bool IsOpaque();
|
||||
|
||||
enum GraphicsExtend {
|
||||
EXTEND_NONE,
|
||||
EXTEND_REPEAT,
|
||||
EXTEND_REFLECT,
|
||||
EXTEND_PAD,
|
||||
|
||||
// Our own private flag for setting either NONE or PAD,
|
||||
// depending on what the platform does for NONE. This is only
|
||||
// relevant for surface patterns; for all other patterns, it
|
||||
// behaves identical to PAD. On MacOS X, this becomes "NONE",
|
||||
// because Quartz does the thing that we want at image edges;
|
||||
// similarily on the win32 printing surface, since
|
||||
// everything's done with GDI there. On other platforms, it
|
||||
// usually becomes PAD.
|
||||
EXTEND_PAD_EDGE = 1000
|
||||
};
|
||||
|
||||
// none, repeat, reflect
|
||||
void SetExtend(GraphicsExtend extend);
|
||||
GraphicsExtend Extend() const;
|
||||
// clamp, repeat, reflect
|
||||
void SetExtend(mozilla::gfx::ExtendMode aExtend);
|
||||
|
||||
int CairoStatus();
|
||||
|
||||
@ -91,7 +73,7 @@ private:
|
||||
mozilla::gfx::Matrix mPatternToUserSpace;
|
||||
mozilla::RefPtr<mozilla::gfx::GradientStops> mStops;
|
||||
nsTArray<mozilla::gfx::GradientStop> mStopsList;
|
||||
GraphicsExtend mExtend;
|
||||
mozilla::gfx::ExtendMode mExtend;
|
||||
};
|
||||
|
||||
#endif /* GFX_PATTERN_H */
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user