This commit is contained in:
Ryan VanderMeulen 2015-02-09 16:40:25 -05:00
Родитель 58278bdf08 67c4b20687
Коммит e7e0e7b5cb
275 изменённых файлов: 5225 добавлений и 4236 удалений

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e06971db7acf7a35c32eb74d675a4e12e288e6be">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0d7b35f23402c4cb29bca6b98280fec48a196dec"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0cf517083f7eb5fc269e1236edba50534f65e3cd"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
@ -23,7 +23,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0d6ed91bdcc40fe0878fac9a6b7362c7b2680d57"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="da777082e02eec11c4b7e27679bdb15f47a44f66"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>
@ -35,7 +35,7 @@
<project name="device/sample" path="device/sample" revision="1a3d8efa0ad32ec8f145367a3cf0f54b97385c3c"/>
<project name="platform/abi/cpp" path="abi/cpp" revision="18f1b5e28734183ff8073fe86dc46bc4ebba8a59"/>
<project name="platform/bionic" path="bionic" revision="86b1f589c313422a7da1812512b9ec8d1cf9ba3c"/>
<project name="platform/bootable/recovery" path="bootable/recovery" revision="75a2463ff719f242759de5c6c7555473dab05b68"/>
<project name="platform/bootable/recovery" path="bootable/recovery" revision="286354e69491f7cba5b9ec6b551831fe6f85ad0d"/>
<project name="platform/external/aac" path="external/aac" revision="fa3eba16446cc8f2f5e2dfc20d86a49dbd37299e"/>
<project name="platform/external/bison" path="external/bison" revision="c2418b886165add7f5a31fc5609f0ce2d004a90e"/>
<project name="platform/external/bluetooth/bluedroid" path="external/bluetooth/bluedroid" revision="c8e99ca7e11c00f8124196fe1726a15e6e976587"/>
@ -134,9 +134,9 @@
<project name="platform/hardware/akm" path="hardware/akm" revision="6d3be412647b0eab0adff8a2768736cf4eb68039"/>
<project groups="invensense" name="platform/hardware/invensense" path="hardware/invensense" revision="e6d9ab28b4f4e7684f6c07874ee819c9ea0002a2"/>
<project name="platform/hardware/ril" path="hardware/ril" revision="865ce3b4a2ba0b3a31421ca671f4d6c5595f8690"/>
<project name="kernel/common" path="kernel" revision="6c6f012cea17fb8b3263605737816cf6663432f1"/>
<project name="kernel/common" path="kernel" revision="b1b623fcc5c8a22f4e9cb30470378496e03c9404"/>
<project name="platform/system/core" path="system/core" revision="53d584d4a4b4316e4de9ee5f210d662f89b44e7e"/>
<project name="u-boot" path="u-boot" revision="cb37a7434073bb47c4c066f6922006442dcd8531"/>
<project name="u-boot" path="u-boot" revision="64b93dbec64421a05bc7ffdbc03917700d171570"/>
<project name="vendor/sprd/gps" path="vendor/sprd/gps" revision="6974f8e771d4d8e910357a6739ab124768891e8f"/>
<project name="vendor/sprd/open-source" path="vendor/sprd/open-source" revision="f56ab768cb9f1ad42fb0809ffec1424b1e693369"/>
<project name="vendor/sprd/partner" path="vendor/sprd/partner" revision="8649c7145972251af11b0639997edfecabfc7c2e"/>

Просмотреть файл

@ -19,13 +19,13 @@
<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="0d7b35f23402c4cb29bca6b98280fec48a196dec"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="0cf517083f7eb5fc269e1236edba50534f65e3cd"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="eb1795a9002eb142ac58c8d68f8f4ba094af07ca"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="2c31ac3a31a340b40ecd9c291df9b9613d3afa72"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0d6ed91bdcc40fe0878fac9a6b7362c7b2680d57"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="da777082e02eec11c4b7e27679bdb15f47a44f66"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
<project name="platform_bionic" path="bionic" remote="b2g" revision="e2b3733ba3fa5e3f404e983d2e4142b1f6b1b846"/>

Просмотреть файл

@ -17,10 +17,10 @@
</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="0d7b35f23402c4cb29bca6b98280fec48a196dec"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0cf517083f7eb5fc269e1236edba50534f65e3cd"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0d6ed91bdcc40fe0878fac9a6b7362c7b2680d57"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="da777082e02eec11c4b7e27679bdb15f47a44f66"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e06971db7acf7a35c32eb74d675a4e12e288e6be">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0d7b35f23402c4cb29bca6b98280fec48a196dec"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0cf517083f7eb5fc269e1236edba50534f65e3cd"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
@ -23,7 +23,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0d6ed91bdcc40fe0878fac9a6b7362c7b2680d57"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="da777082e02eec11c4b7e27679bdb15f47a44f66"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="f92a936f2aa97526d4593386754bdbf02db07a12"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="6e47ff2790f5656b5b074407829ceecf3e6188c4"/>

Просмотреть файл

@ -19,13 +19,13 @@
<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="0d7b35f23402c4cb29bca6b98280fec48a196dec"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="0cf517083f7eb5fc269e1236edba50534f65e3cd"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="eb1795a9002eb142ac58c8d68f8f4ba094af07ca"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="2c31ac3a31a340b40ecd9c291df9b9613d3afa72"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0d6ed91bdcc40fe0878fac9a6b7362c7b2680d57"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="da777082e02eec11c4b7e27679bdb15f47a44f66"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
<project name="platform_bionic" path="bionic" remote="b2g" revision="e2b3733ba3fa5e3f404e983d2e4142b1f6b1b846"/>

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="e06971db7acf7a35c32eb74d675a4e12e288e6be">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0d7b35f23402c4cb29bca6b98280fec48a196dec"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0cf517083f7eb5fc269e1236edba50534f65e3cd"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
@ -23,7 +23,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0d6ed91bdcc40fe0878fac9a6b7362c7b2680d57"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="da777082e02eec11c4b7e27679bdb15f47a44f66"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>

Просмотреть файл

@ -17,10 +17,10 @@
</project>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0d7b35f23402c4cb29bca6b98280fec48a196dec"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0cf517083f7eb5fc269e1236edba50534f65e3cd"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0d6ed91bdcc40fe0878fac9a6b7362c7b2680d57"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="da777082e02eec11c4b7e27679bdb15f47a44f66"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

Просмотреть файл

@ -1,9 +1,9 @@
{
"git": {
"git_revision": "0d7b35f23402c4cb29bca6b98280fec48a196dec",
"git_revision": "0cf517083f7eb5fc269e1236edba50534f65e3cd",
"remote": "https://git.mozilla.org/releases/gaia.git",
"branch": ""
},
"revision": "42545ce7016477c408fe5c009709f07a88b1325d",
"revision": "13fba23da899bce302aa98aaf4a429eb52fb341b",
"repo_path": "integration/gaia-central"
}

Просмотреть файл

@ -17,10 +17,10 @@
</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="0d7b35f23402c4cb29bca6b98280fec48a196dec"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0cf517083f7eb5fc269e1236edba50534f65e3cd"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0d6ed91bdcc40fe0878fac9a6b7362c7b2680d57"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="da777082e02eec11c4b7e27679bdb15f47a44f66"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

Просмотреть файл

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="7f2ee9f4cb926684883fc2a2e407045fd9db2199">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0d7b35f23402c4cb29bca6b98280fec48a196dec"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="0cf517083f7eb5fc269e1236edba50534f65e3cd"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
@ -23,7 +23,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="0d6ed91bdcc40fe0878fac9a6b7362c7b2680d57"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="da777082e02eec11c4b7e27679bdb15f47a44f66"/>
<!-- Stock Android things -->
<project groups="pdk,linux" name="platform/prebuilts/clang/linux-x86/host/3.5" path="prebuilts/clang/linux-x86/host/3.5" revision="50d1ca4ab8add54523b7bc692860d57e8ee4c0d1"/>
<project groups="pdk,linux,arm" name="platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" path="prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" revision="fb3845864573857677f9b500040a8f011eaf5078"/>

Просмотреть файл

@ -1,6 +1,6 @@
[
{
"clang_version": "r170890"
"clang_version": "r183744"
},
{
"size": 88,
@ -9,8 +9,8 @@
"filename": "setup.sh"
},
{
"size": 56126352,
"digest": "e156e2a39abd5bf272ee30748a6825f22ddd27565b097c66662a2a6f2e9892bc5b4bf30a3552dffbe867dbfc39e7ee086e0b2cd7935f6ea216c0cf936178a88f",
"size": 59602619,
"digest": "86662ebc0ef650490559005948c4f0cb015dad72c7cac43732c2bf2995247081e30c139cf8008d19670a0009fc302c4eee2676981ee3f9ff4a15c01af22b783b",
"algorithm": "sha512",
"filename": "clang.tar.bz2"
},

Просмотреть файл

@ -446,6 +446,9 @@ PluginContent.prototype = {
.add(pluginRect.width * pluginRect.height);
let state = this._getPluginInfo(plugin).fallbackType;
if (state === null) {
state = Ci.nsIObjectLoadingContent.PLUGIN_UNSUPPORTED;
}
Services.telemetry.getHistogramById('FLASH_PLUGIN_STATES')
.add(state);
}

Просмотреть файл

@ -76,6 +76,8 @@
#include "AppProcessChecker.h"
#include "ContentParent.h"
#include "TabParent.h"
#include "mozilla/plugins/PPluginWidgetParent.h"
#include "../plugins/ipc/PluginWidgetParent.h"
#include "mozilla/AsyncEventDispatcher.h"
#include "mozilla/GuardObjects.h"
#include "mozilla/Preferences.h"
@ -970,6 +972,8 @@ nsFrameLoader::SwapWithOtherRemoteLoader(nsFrameLoader* aOther,
nsRefPtr<nsFrameLoader>& aFirstToSwap,
nsRefPtr<nsFrameLoader>& aSecondToSwap)
{
MOZ_ASSERT(NS_IsMainThread());
Element* ourContent = mOwnerContent;
Element* otherContent = aOther->mOwnerContent;
@ -1024,6 +1028,17 @@ nsFrameLoader::SwapWithOtherRemoteLoader(nsFrameLoader* aOther,
return rv;
}
// Native plugin windows used by this remote content need to be reparented.
const nsTArray<mozilla::plugins::PPluginWidgetParent*>& plugins =
aOther->mRemoteBrowser->ManagedPPluginWidgetParent();
nsPIDOMWindow* newWin = ourDoc->GetWindow();
if (newWin) {
nsRefPtr<nsIWidget> newParent = ((nsGlobalWindow*)newWin)->GetMainWidget();
for (uint32_t idx = 0; idx < plugins.Length(); ++idx) {
static_cast<mozilla::plugins::PluginWidgetParent*>(plugins[idx])->SetParent(newParent);
}
}
SetOwnerContent(otherContent);
aOther->SetOwnerContent(ourContent);

Просмотреть файл

@ -0,0 +1,21 @@
--- nsFrameLoader.cpp
+++ nsFrameLoader.cpp
@@ -48,17 +48,17 @@
#include "nsIDOMHTMLDocument.h"
#include "nsIXULWindow.h"
#include "nsIEditor.h"
#include "nsIMozBrowserFrame.h"
#include "nsIPermissionManager.h"
#include "nsISHistory.h"
#include "nsNullPrincipal.h"
#include "nsIScriptError.h"
-
+#include "nsGlobalWindow.h"
#include "nsLayoutUtils.h"
#include "nsView.h"
#include "nsIURI.h"
#include "nsIURL.h"
#include "nsNetUtil.h"
#include "nsGkAtoms.h"

Просмотреть файл

@ -14,6 +14,8 @@
body { font-family: Ahem; font-size: 20px; }
s { -moz-user-select: none; }
n { display: none; }
a { position:absolute; bottom: 0; right:0; }
.text { -moz-user-select: text; }
</style>
</head>
@ -31,6 +33,7 @@ n { display: none; }
<div id="testA">aaaaaaa<n>bbb<s>bbbbb</s></n>ccccccc</div>
<div id="testB"><n><s>aaaa</s>aaa</n>bbbbbbbbccccccc</div>
<div id="testC">aaaaaaabbbbbbbb<n>cc<s>c</s>cccc</n></div>
<div id="testE">aaa<s id="testEc1">aaaa<a class="text">bbbb</a>dd<a>cccc</a>ddddddd</s>eeee</div>
<iframe id="testD" src="data:text/html,<body>aaaa<span style='-moz-user-select:none'>bbbb</span>cccc"></iframe>
@ -44,6 +47,14 @@ function test()
var sel = (w ? w : window).getSelection();
sel.removeAllRanges();
}
function doneTest(e)
{
// We hide the elements we're done with so that later tests
// are inside the rather narrow iframe mochitest gives us.
// It matters for synthesizeMouse event tests.
e.style.display = 'none';
e.offsetHeight;
}
function dragSelect(e, x1, x2, x3)
{
@ -75,16 +86,18 @@ function test()
}
}
function NL(s) { return s.replace(/(\r\n|\n\r|\r)/g, '\n'); }
function checkText(text, e)
{
var sel = window.getSelection();
is(sel.toString(), text, e.id + ": selected text")
is(NL(sel.toString()), text, e.id + ": selected text")
}
function checkRangeText(text, index)
{
var r = window.getSelection().getRangeAt(index);
is(r.toString(), text, e.id + ": range["+index+"].toString()")
is(NL(r.toString()), text, e.id + ": range["+index+"].toString()")
}
function node(e, index)
@ -92,17 +105,27 @@ function test()
return index == -1 ? e : e.childNodes[index];
}
function checkRanges(arr, e)
function checkRangeCount(n, e)
{
var sel = window.getSelection();
is(sel.rangeCount, arr.length, e.id + ": Selection range count");
is(sel.rangeCount, n, e.id + ": Selection range count");
}
function checkRange(i, expected, e) {
var sel = window.getSelection();
var r = sel.getRangeAt(i);
is(r.startContainer, node(e, expected[0]), e.id + ": range["+i+"].startContainer");
is(r.startOffset, expected[1], e.id + ": range["+i+"].startOffset");
is(r.endContainer, node(e, expected[2]), e.id + ": range["+i+"].endContainer");
is(r.endOffset, expected[3], e.id + ": range["+i+"].endOffset");
}
function checkRanges(arr, e)
{
checkRangeCount(arr.length, e);
for (i = 0; i < arr.length; ++i) {
var expected = arr[i];
var r = sel.getRangeAt(i);
is(r.startContainer, node(e, expected[0]), e.id + ": range["+i+"].startContainer");
is(r.startOffset, expected[1], e.id + ": range["+i+"].startOffset");
is(r.endContainer, node(e, expected[2]), e.id + ": range["+i+"].endContainer");
is(r.endOffset, expected[3], e.id + ": range["+i+"].endOffset");
checkRange(i, expected, e);
}
}
@ -119,6 +142,7 @@ function test()
dragSelect(e, 20, 260, 120);
checkText('aaaaa', e);
checkRanges([[0,1,0,6]], e);
doneTest(e);
clear();
e = document.getElementById('test2');
@ -130,48 +154,56 @@ function test()
dragSelect(e, 340, 20, 140);
checkText('bbbbbbbbcc', e);
checkRanges([[1,0,1,10]], e);
// #test2 is used again below
clear();
e = document.getElementById('test3');
dragSelect(e, 20, 340, 295);
checkText('aaaaaabbbbbbbb', e);
checkRanges([[0,1,0,15]], e);
// #test3 is used again below
clear();
e = document.getElementById('test4');
dragSelect(e, 20, 340);
checkText('aaaaaacc', e);
checkRanges([[0,1,1,0], [2,0,2,2]], e);
doneTest(e);
clear();
e = document.getElementById('test5');
dragSelect(e, 340, 20, 140);
checkText('bbbbbbbbcc', e);
checkRanges([[1,0,1,10]], e);
doneTest(e);
clear();
e = document.getElementById('test6');
dragSelect(e, 20, 340, 295);
checkText('aaaaaabbbbbbbb', e);
checkRanges([[0,1,0,15]], e);
doneTest(e);
clear();
e = document.getElementById('test7');
dragSelect(e, 20, 340);
checkText('aaaaaacccccc', e);
checkRanges([[0,1,1,0], [2,0,2,6]], e);
doneTest(e);
clear();
e = document.getElementById('test8');
dragSelect(e, 340, 20, 140);
checkText('bbbbbccccc', e);
checkRanges([[1,3,1,13]], e);
doneTest(e);
clear();
e = document.getElementById('test9');
dragSelect(e, 20, 340, 295);
checkText('aaaaaabbbbbbbb', e);
checkRanges([[0,1,0,15]], e);
doneTest(e);
clear();
e = document.getElementById('testA');
@ -179,18 +211,24 @@ function test()
checkText('aaaaaaccccccc', e);
checkRanges([[0,1,2,7]], e);
checkRangeText('aaaaaabbbbbbbbccccccc', 0);
doneTest(e);
clear();
e = document.getElementById('testB');
dragSelect(e, 340, 20, 140);
checkText('bbbbbbbccccccc', e);
checkRanges([[1,1,1,15]], e);
doneTest(e);
clear();
e = document.getElementById('test9');
dragSelect(e, 20, 340, 295);
checkText('aaaaaabbbbbbbb', e);
checkRanges([[0,1,0,15]], e);
e = document.getElementById('testE');
dragSelect(e, 20, 360, 295);
checkText('aa\nbbbb\nee', e);
checkRangeCount(3, e);
checkRange(0, [0,1,-1,1], e);
checkRange(1, [1,0,-1,2], e.children[0]);
checkRange(2, [2,0,2,2], e);
doneTest(e);
// ======================================================
// ================== shift+click tests =================
@ -206,6 +244,7 @@ function test()
checkRangeText('bbbbbbbbcc', 0);
checkText('bbbbbbbbcc', e);
checkRanges([[-1,1,1,10]], e);
doneTest(e);
// test extending a selection that end in a -moz-user-select:none node
clear();
@ -217,6 +256,7 @@ function test()
checkRangeText('aaaaaabbbbbbbb', 0);
checkText('aaaaaabbbbbbbb', e);
checkRanges([[0,1,-1,1]], e);
doneTest(e);
// ======================================================
// ==================== Script tests ====================
@ -247,6 +287,7 @@ function test()
is(sel.rangeCount, 2, "testD: kbd selection is filtered");
is(sel.getRangeAt(0).toString(), 'aaaa', "testD: kbd selection is filtered");
is(sel.getRangeAt(1).toString(), 'cccc', "testD: kbd selection is filtered");
doneTest(e);
clear();
SimpleTest.finish();

Просмотреть файл

@ -4053,7 +4053,9 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
declArgs=declArgs)
def incrementNestingLevel():
return 1 if nestingLevel is "" else ++nestingLevel
if nestingLevel is "":
return 1
return nestingLevel + 1
assert not (isEnforceRange and isClamp) # These are mutually exclusive
@ -6832,12 +6834,14 @@ class CGMethodCall(CGThing):
def filteredSignatures(signatures, descriptor):
def typeExposedInWorkers(type):
return (not type.isGeckoInterface() or
type.inner.isExternal() or
type.inner.isExposedInAnyWorker())
if descriptor.workers:
# Filter out the signatures that should not be exposed in a
# worker. The IDL parser enforces the return value being
# exposed correctly, but we have to check the argument types.
#
# If this code changes, adjust the self._deps
# computation in CGDDescriptor.__init__ as needed.
assert all(typeExposedInWorkers(sig[0]) for sig in signatures)
signatures = filter(
lambda sig: all(typeExposedInWorkers(arg.type)
@ -11008,6 +11012,21 @@ class CGDescriptor(CGThing):
assert not descriptor.concrete or descriptor.interface.hasInterfacePrototypeObject()
self._deps = descriptor.interface.getDeps()
# If we have a worker descriptor, add dependencies on interface types we
# have as method arguments to overloaded methods. See the
# filteredSignatures() bit in CGMethodCall. Note that we have to add
# both interfaces that _are_ exposed in workers and ones that aren't;
# the idea is that we have to notice when the exposure set changes.
if descriptor.workers:
methods = (m for m in descriptor.interface.members if
m.isMethod() and isMaybeExposedIn(m, descriptor) and
len(m.signatures()) != 1)
for m in methods:
for sig in m.signatures():
for arg in sig[1]:
if (arg.type.isGeckoInterface() and
not arg.type.inner.isExternal()):
self._deps.add(arg.type.inner.filename())
cgThings = []
cgThings.append(CGGeneric(declare="typedef %s NativeType;\n" %

Просмотреть файл

@ -206,14 +206,11 @@ class Configuration:
elif key == 'isNavigatorProperty':
getter = lambda x: x.interface.getNavigatorProperty() != None
elif key == 'isExposedInAnyWorker':
getter = lambda x: (not x.interface.isExternal() and
x.interface.isExposedInAnyWorker())
getter = lambda x: x.interface.isExposedInAnyWorker()
elif key == 'isExposedInSystemGlobals':
getter = lambda x: (not x.interface.isExternal() and
x.interface.isExposedInSystemGlobals())
getter = lambda x: x.interface.isExposedInSystemGlobals()
elif key == 'isExposedInWindow':
getter = lambda x: (not x.interface.isExternal() and
x.interface.isExposedInWindow())
getter = lambda x: x.interface.isExposedInWindow()
else:
# Have to watch out: just closing over "key" is not enough,
# since we're about to mutate its value

Просмотреть файл

@ -448,15 +448,65 @@ class IDLIdentifierPlaceholder(IDLObjectWithIdentifier):
obj = self.identifier.resolve(scope, None)
return scope.lookupIdentifier(obj)
class IDLExternalInterface(IDLObjectWithIdentifier):
class IDLExposureMixins():
def __init__(self, location):
# _exposureGlobalNames are the global names listed in our [Exposed]
# extended attribute. exposureSet is the exposure set as defined in the
# Web IDL spec: it contains interface names.
self._exposureGlobalNames = set()
self.exposureSet = set()
self._location = location
def finish(self, scope):
# Verify that our [Exposed] value, if any, makes sense.
for globalName in self._exposureGlobalNames:
if globalName not in scope.globalNames:
raise WebIDLError("Unknown [Exposed] value %s" % globalName,
[self._location])
if len(self._exposureGlobalNames) == 0:
self._exposureGlobalNames.add(scope.primaryGlobalName)
globalNameSetToExposureSet(scope, self._exposureGlobalNames,
self.exposureSet)
def isExposedInWindow(self):
return 'Window' in self.exposureSet
def isExposedInAnyWorker(self):
return len(self.getWorkerExposureSet()) > 0
def isExposedInSystemGlobals(self):
return 'BackstagePass' in self.exposureSet
def isExposedInSomeButNotAllWorkers(self):
"""
Returns true if the Exposed extended attribute for this interface
exposes it in some worker globals but not others. The return value does
not depend on whether the interface is exposed in Window or System
globals.
"""
if not self.isExposedInAnyWorker():
return False
workerScopes = self.parentScope.globalNameMapping["Worker"]
return len(workerScopes.difference(self.exposureSet)) > 0
def getWorkerExposureSet(self):
# Subclasses that might be exposed in workers should override as needed
return set()
class IDLExternalInterface(IDLObjectWithIdentifier, IDLExposureMixins):
def __init__(self, location, parentScope, identifier):
assert isinstance(identifier, IDLUnresolvedIdentifier)
assert isinstance(parentScope, IDLScope)
self.parent = None
IDLObjectWithIdentifier.__init__(self, location, parentScope, identifier)
IDLExposureMixins.__init__(self, location)
IDLObjectWithIdentifier.resolve(self, parentScope)
def finish(self, scope):
IDLExposureMixins.finish(self, scope)
pass
def validate(self):
@ -547,7 +597,7 @@ def globalNameSetToExposureSet(globalScope, nameSet, exposureSet):
for name in nameSet:
exposureSet.update(globalScope.globalNameMapping[name])
class IDLInterface(IDLObjectWithScope):
class IDLInterface(IDLObjectWithScope, IDLExposureMixins):
def __init__(self, location, parentScope, name, parent, members,
isKnownNonPartial):
assert isinstance(parentScope, IDLScope)
@ -582,13 +632,9 @@ class IDLInterface(IDLObjectWithScope):
self.totalMembersInSlots = 0
# Tracking of the number of own own members we have in slots
self._ownMembersInSlots = 0
# _exposureGlobalNames are the global names listed in our [Exposed]
# extended attribute. exposureSet is the exposure set as defined in the
# Web IDL spec: it contains interface names.
self._exposureGlobalNames = set()
self.exposureSet = set()
IDLObjectWithScope.__init__(self, location, parentScope, name)
IDLExposureMixins.__init__(self, location)
if isKnownNonPartial:
self.setNonPartial(location, parent, members)
@ -628,17 +674,7 @@ class IDLInterface(IDLObjectWithScope):
"declaration" % self.identifier.name,
[self.location])
# Verify that our [Exposed] value, if any, makes sense.
for globalName in self._exposureGlobalNames:
if globalName not in scope.globalNames:
raise WebIDLError("Unknown [Exposed] value %s" % globalName,
[self.location])
if len(self._exposureGlobalNames) == 0:
self._exposureGlobalNames.add(scope.primaryGlobalName)
globalNameSetToExposureSet(scope, self._exposureGlobalNames,
self.exposureSet)
IDLExposureMixins.finish(self, scope)
# Now go ahead and merge in our partial interfaces.
for partial in self._partialInterfaces:
@ -1063,27 +1099,6 @@ class IDLInterface(IDLObjectWithScope):
len(set(m.identifier.name for m in self.members if
m.isMethod() and not m.isStatic())) == 1)
def isExposedInWindow(self):
return 'Window' in self.exposureSet
def isExposedInAnyWorker(self):
return len(self.getWorkerExposureSet()) > 0
def isExposedInSystemGlobals(self):
return 'BackstagePass' in self.exposureSet
def isExposedInSomeButNotAllWorkers(self):
"""
Returns true if the Exposed extended attribute for this interface
exposes it in some worker globals but not others. The return value does
not depend on whether the interface is exposed in Window or System
globals.
"""
if not self.isExposedInAnyWorker():
return False
workerScopes = self.parentScope.globalNameMapping["Worker"]
return len(workerScopes.difference(self.exposureSet)) > 0
def getWorkerExposureSet(self):
workerScopes = self.parentScope.globalNameMapping["Worker"]
return workerScopes.intersection(self.exposureSet)

Просмотреть файл

@ -419,7 +419,9 @@ public:
void ReceiveNullableObjectSequence(JSContext*, nsTArray<JSObject*>&);
void PassSequenceOfSequences(const Sequence< Sequence<int32_t> >&);
void PassSequenceOfSequencesOfSequences(const Sequence<Sequence<Sequence<int32_t>>>&);
void ReceiveSequenceOfSequences(nsTArray< nsTArray<int32_t> >&);
void ReceiveSequenceOfSequencesOfSequences(nsTArray<nsTArray<nsTArray<int32_t>>>&);
// MozMap types
void PassMozMap(const MozMap<int32_t> &);

Просмотреть файл

@ -406,7 +406,9 @@ interface TestInterface {
sequence<object?> receiveNullableObjectSequence();
void passSequenceOfSequences(sequence<sequence<long>> arg);
void passSequenceOfSequencesOfSequences(sequence<sequence<sequence<long>>> arg);
sequence<sequence<long>> receiveSequenceOfSequences();
sequence<sequence<sequence<long>>> receiveSequenceOfSequencesOfSequences();
// MozMap types
void passMozMap(MozMap<long> arg);

Просмотреть файл

@ -271,6 +271,7 @@ interface TestExampleInterface {
sequence<object?> receiveNullableObjectSequence();
void passSequenceOfSequences(sequence<sequence<long>> arg);
void passSequenceOfSequencesOfSequences(sequence<sequence<sequence<long>>> arg);
//XXXbz No support for sequence of sequence return values yet.
//sequence<sequence<long>> receiveSequenceOfSequences();

Просмотреть файл

@ -283,6 +283,7 @@ interface TestJSImplInterface {
sequence<object?> receiveNullableObjectSequence();
void passSequenceOfSequences(sequence<sequence<long>> arg);
void passSequenceOfSequencesOfSequences(sequence<sequence<sequence<long>>> arg);
//XXXbz No support for sequence of sequence return values yet.
//sequence<sequence<long>> receiveSequenceOfSequences();

Просмотреть файл

@ -2,8 +2,8 @@ onconnect = function(evt) {
evt.ports[0].onmessage = function(evt) {
var bc = new BroadcastChannel('foobar');
bc.addEventListener('message', function(event) {
evt.target.postMessage(event.data == "hello world from the window" ? "OK" : "KO");
bc.postMessage("hello world from the worker");
bc.postMessage(event.data == "hello world from the window" ?
"hello world from the worker" : "KO");
bc.close();
}, false);

Просмотреть файл

@ -29,8 +29,6 @@ function runTests() {
if (event.data == "READY") {
ok(true, "SharedWorker is ready!");
bc.postMessage('hello world from the window');
} else if(event.data == "OK") {
ok(true, "SharedWorker has received the message");
} else {
ok(false, "Something wrong happened");
}

Просмотреть файл

@ -172,5 +172,14 @@ TimeRanges::WrapObject(JSContext* aCx, JS::MutableHandle<JSObject*> aReflector)
return TimeRangesBinding::Wrap(aCx, this, aReflector);
}
void
TimeRanges::Shift(double aOffset)
{
for (index_type i = 0; i < mRanges.Length(); ++i) {
mRanges[i].mStart += aOffset;
mRanges[i].mEnd += aOffset;
}
}
} // namespace dom
} // namespace mozilla

Просмотреть файл

@ -61,6 +61,9 @@ public:
virtual double End(uint32_t aIndex, ErrorResult& aRv);
// Shift all values by aOffset seconds.
void Shift(double aOffset);
private:
~TimeRanges();

Просмотреть файл

@ -149,7 +149,7 @@ StkIconInfo.prototype = {
function StkItem(aIdentifier, aText, aStkIconInfo) {
this.identifier = aIdentifier;
if (aText) {
if (aText !== undefined) {
this.text = aText;
}
this.iconInfo = aStkIconInfo;
@ -318,7 +318,7 @@ function StkSetUpMenuCmd(aCommandDetails) {
let options = aCommandDetails.options;
if (options.title) {
if (options.title !== undefined) {
this.title = options.title;
}
@ -414,13 +414,10 @@ function StkSetUpMenuMessage(aStkSetUpMenuCmd) {
return item;
}),
isHelpAvailable: aStkSetUpMenuCmd.isHelpAvailable
isHelpAvailable: aStkSetUpMenuCmd.isHelpAvailable,
title: aStkSetUpMenuCmd.title
};
if (aStkSetUpMenuCmd.title) {
this.options.title = aStkSetUpMenuCmd.title;
}
let nextActionList = aStkSetUpMenuCmd.getNextActionList();
if (nextActionList && nextActionList.length > 0) {
this.options.nextActionList = nextActionList;
@ -482,7 +479,7 @@ function StkTextMessageCmd(aCommandDetails) {
let options = aCommandDetails.options;
if (options.text) {
if (options.text !== undefined) {
this.text = options.text;
}
@ -503,11 +500,9 @@ function StkTextMessage(aStkTextMessageCmd) {
// Call |StkCommandMessage| constructor.
StkCommandMessage.call(this, aStkTextMessageCmd);
this.options = {};
if (aStkTextMessageCmd.text) {
this.options.text = aStkTextMessageCmd.text;
}
this.options = {
text: aStkTextMessageCmd.text
};
if (aStkTextMessageCmd.iconInfo) {
appendIconInfo(this.options, aStkTextMessageCmd.iconInfo);
@ -562,13 +557,13 @@ function StkInputCmd(aCommandDetails) {
let options = aCommandDetails.options;
if (options.text) {
if (options.text !== undefined) {
this.text = options.text;
}
this.duration = mapDurationToStkDuration(options.duration);
if (options.defaultText) {
if (options.defaultText !== undefined) {
this.defaultText = options.defaultText;
}
@ -607,6 +602,7 @@ function StkInputMessage(aStkInputCmd) {
isAlphabet: aStkInputCmd.isAlphabet,
isUCS2: aStkInputCmd.isUCS2,
isHelpAvailable: aStkInputCmd.isHelpAvailable,
defaultText: aStkInputCmd.defaultText
};
if (aStkInputCmd.duration) {
@ -614,10 +610,6 @@ function StkInputMessage(aStkInputCmd) {
appendDuration(this.options.duration, aStkInputCmd.duration);
}
if (aStkInputCmd.defaultText) {
this.options.defaultText = aStkInputCmd.defaultText;
}
if (aStkInputCmd.iconInfo) {
appendIconInfo(this.options, aStkInputCmd.iconInfo);
}
@ -699,14 +691,14 @@ function StkSetUpCallCmd(aCommandDetails) {
this.address = options.address;
if(confirmMessage) {
if (confirmMessage.text) {
if (confirmMessage.text !== undefined) {
this.confirmText = confirmMessage.text;
}
this.confirmIconInfo = mapIconInfoToStkIconInfo(confirmMessage);
}
if(callMessage) {
if (callMessage.text) {
if (callMessage.text !== undefined) {
this.callText = callMessage.text;
}
this.callIconInfo = mapIconInfoToStkIconInfo(callMessage);
@ -737,22 +729,22 @@ function StkSetUpCallMessage(aStkSetUpCallCmd) {
address: aStkSetUpCallCmd.address
};
if (aStkSetUpCallCmd.confirmText || aStkSetUpCallCmd.confirmIconInfo) {
let confirmMessage = {};
if (aStkSetUpCallCmd.confirmText) {
confirmMessage.text = aStkSetUpCallCmd.confirmText;
}
if (aStkSetUpCallCmd.confirmText !== null ||
aStkSetUpCallCmd.confirmIconInfo) {
let confirmMessage = {
text: aStkSetUpCallCmd.confirmText
};
if (aStkSetUpCallCmd.confirmIconInfo) {
appendIconInfo(confirmMessage, aStkSetUpCallCmd.confirmIconInfo);
}
this.options.confirmMessage = confirmMessage;
}
if (aStkSetUpCallCmd.callText || aStkSetUpCallCmd.callIconInfo) {
let callMessage = {};
if (aStkSetUpCallCmd.callText) {
callMessage.text = aStkSetUpCallCmd.callText;
}
if (aStkSetUpCallCmd.callText !== null ||
aStkSetUpCallCmd.callIconInfo) {
let callMessage = {
text: aStkSetUpCallCmd.callText
};
if (aStkSetUpCallCmd.callIconInfo) {
appendIconInfo(callMessage, aStkSetUpCallCmd.callIconInfo);
}
@ -779,7 +771,7 @@ function StkBrowserSettingCmd(aCommandDetails) {
let confirmMessage = options.confirmMessage;
if(confirmMessage) {
if (confirmMessage.text) {
if (confirmMessage.text !== undefined) {
this.confirmText = confirmMessage.text;
}
this.confirmIconInfo = mapIconInfoToStkIconInfo(confirmMessage);
@ -807,11 +799,11 @@ function StkBrowserSettingMessage(aStkBrowserSettingCmd) {
mode: aStkBrowserSettingCmd.mode
};
if (aStkBrowserSettingCmd.confirmText || aStkBrowserSettingCmd.confirmIconInfo) {
let confirmMessage = {};
if (aStkBrowserSettingCmd.confirmText) {
confirmMessage.text = aStkBrowserSettingCmd.confirmText;
}
if (aStkBrowserSettingCmd.confirmText !== null ||
aStkBrowserSettingCmd.confirmIconInfo) {
let confirmMessage = {
text: aStkBrowserSettingCmd.confirmText
};
if (aStkBrowserSettingCmd.confirmIconInfo) {
appendIconInfo(confirmMessage, aStkBrowserSettingCmd.confirmIconInfo);
}
@ -826,7 +818,7 @@ function StkPlayToneCmd(aCommandDetails) {
let options = aCommandDetails.options;
if(options.text) {
if(options.text !== undefined) {
this.text = options.text;
}
@ -862,13 +854,10 @@ function StkPlayToneMessage(aStkPlayToneCmd) {
StkCommandMessage.call(this, aStkPlayToneCmd);
this.options = {
isVibrate: aStkPlayToneCmd.isVibrate
isVibrate: aStkPlayToneCmd.isVibrate,
text: aStkPlayToneCmd.text
};
if (aStkPlayToneCmd.text) {
this.options.text = aStkPlayToneCmd.text;
}
if (aStkPlayToneCmd.tone != Ci.nsIStkPlayToneCmd.TONE_TYPE_INVALID) {
this.options.tone = aStkPlayToneCmd.tone;
}

Просмотреть файл

@ -287,6 +287,36 @@ function waitForTargetEvent(aEventTarget, aEventName, aMatchFun) {
});
}
/**
* Wait for one named system message.
*
* Resolve if that named message is received. Never reject.
*
* Fulfill params: the message passed.
*
* @param aEventName
* A string message name.
* @param aMatchFun [optional]
* A matching function returns true or false to filter the message. If no
* matching function passed the promise is resolved after receiving the
* first message.
*
* @return A deferred promise.
*/
function waitForSystemMessage(aMessageName, aMatchFun) {
let target = workingFrame.contentWindow.navigator;
return new Promise(function(aResolve, aReject) {
target.mozSetMessageHandler(aMessageName, function(aMessage) {
if (!aMatchFun || aMatchFun(aMessage)) {
target.mozSetMessageHandler(aMessageName, null);
ok(true, "System message '" + aMessageName + "' got.");
aResolve(aMessage);
}
});
});
}
/**
* Set radio enabling state and wait for "radiostatechange" event.
*

Просмотреть файл

@ -12,7 +12,9 @@ qemu = true
[test_icc_card_state.js]
[test_icc_info.js]
[test_stk_refresh.js]
[test_stk_play_tone.js]
[test_stk_poll_off.js]
[test_stk_poll_interval.js]
[test_stk_setup_event_list.js]
[test_stk_setup_call.js]
[test_stk_send_ss.js]

Просмотреть файл

@ -6,36 +6,102 @@ MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
// Open channel.
{command: "d04f81030140018202818205074f70656e204944350702030403041f0239020578470a065465737447700272730d08f4557365724c6f670d08f4557365725077643c0301ad9c3e0521010101019e020007",
{command: "D02E" + // Length
"8103014001" + // Command details
"82028182" + // Device identities
"05074F70656E204944" + // Alpha identifier
"9E020007" + // Icon identifier
"86099111223344556677F8" + // Address
"350702030403041F02" + // Bear description
"39020578", // Buffer size
expect: {typeOfCommand: MozIccManager.STK_CMD_OPEN_CHANNEL,
commandQualifier: 0x01,
text: "Open ID",
iconSelfExplanatory: true,
icons: [COLOR_ICON, COLOR_TRANSPARENCY_ICON]}},
{command: "d0448103014001820281820500350702030403041f0239020578470a065465737447700272730d08f4557365724c6f670d08f4557365725077643c0301ad9c3e052101010101",
{command: "D023" + // Length
"8103014001" + // Command details
"82028182" + // Device identities
"0500" + // Alpha identifier
"86099111223344556677F8" + // Address
"350702030403041F02" + // Bear description
"39020578", // Buffer size
expect: {typeOfCommand: MozIccManager.STK_CMD_OPEN_CHANNEL,
commandQualifier: 0x01,
text: ""}},
{command: "d05381030140018202818205094f70656e2049442031350702030403041f0239020578470a065465737447700272730d08f4557365724c6f670d08f4557365725077643c0301ad9c3e052101010101d004000900b4",
{command: "D02C" + // Length
"8103014001" + // Command details
"82028182" + // Device identities
"05094F70656E2049442031" + // Alpha identifier
"86099111223344556677F8" + // Address
"350702030403041F02" + // Bear description
"39020578", // Buffer size
expect: {typeOfCommand: MozIccManager.STK_CMD_OPEN_CHANNEL,
commandQualifier: 0x01,
text: "Open ID 1"}},
// Close channel.
{command: "d01b810301410082028121850a436c6f73652049442031d004000a00b4",
{command: "D00D" + // Length
"8103014100" + // Command details
"82028182" + // Device identities
"9E020007", // Icon identifier
expect: {typeOfCommand: MozIccManager.STK_CMD_CLOSE_CHANNEL,
commandQualifier: 0x00,
iconSelfExplanatory: true,
icons: [COLOR_ICON, COLOR_TRANSPARENCY_ICON]}},
{command: "D015" + // Length
"8103014100" + // Command details
"82028121" + // Device identities
"850A436C6F73652049442031", // Alpha identifier
expect: {typeOfCommand: MozIccManager.STK_CMD_CLOSE_CHANNEL,
commandQualifier: 0x00,
text: "Close ID 1"}},
// Recive data.
{command: "d022810301420082028121850e5265636569766520446174612031b701c8d004000e00b4",
// Receive data.
{command: "D00C" + // Length
"8103014200" + // Command details
"82028121" + // Device identities
"B701C8", // Channel data length
expect: {typeOfCommand: MozIccManager.STK_CMD_RECEIVE_DATA,
commandQualifier: 0x00}},
{command: "D01C" + // Length
"8103014200" + // Command details
"82028121" + // Device identities
"850E5265636569766520446174612031" + // Alpha identifier
"B701C8", // Channel data length
expect: {typeOfCommand: MozIccManager.STK_CMD_RECEIVE_DATA,
commandQualifier: 0x00,
text: "Receive Data 1"}},
// Send data.
{command: "d026810301430182028121850b53656e6420446174612031b6080001020304050607d004000b00b4",
{command: "D017" + // Length
"8103014301" + // Command details
"82028121" + // Device identities
"9E020007" + // Icon identifier
"B6080001020304050607", // Channel data
expect: {typeOfCommand: MozIccManager.STK_CMD_SEND_DATA,
commandQualifier: 0x01,
iconSelfExplanatory: true,
icons: [COLOR_ICON, COLOR_TRANSPARENCY_ICON]}},
{command: "D020" + // Length
"8103014301" + // Command details
"82028121" + // Device identities
"850B53656E6420446174612031" + // Alpha identifier
"B6080001020304050607", // Channel data
expect: {typeOfCommand: MozIccManager.STK_CMD_SEND_DATA,
commandQualifier: 0x01,
text: "Send Data 1"}},
];
function testBipCommand(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, aExpect.typeOfCommand, "typeOfCommand");
is(aCommand.options.text, aExpect.text, "options.text");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
if (aExpect.icons) {
// text is optional.
if ("text" in aExpect) {
is(aCommand.options.text, aExpect.text, "options.text");
}
// icons is optional.
if ("icons" in aExpect) {
isIcons(aCommand.options.icons, aExpect.icons);
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
"options.iconSelfExplanatory");
@ -55,6 +121,12 @@ startTestCommon(function() {
// Wait onstkcommand event.
promises.push(waitForTargetEvent(icc, "stkcommand")
.then((aEvent) => testBipCommand(aEvent.command, data.expect)));
// Wait icc-stkcommand system message.
promises.push(waitForSystemMessage("icc-stkcommand")
.then((aMessage) => {
is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
testBipCommand(aMessage.command, data.expect);
}));
// Send emulator command to generate stk unsolicited event.
promises.push(sendEmulatorStkPdu(data.command));

Просмотреть файл

@ -5,150 +5,176 @@ MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "d01a8103012180820281028d0f04546f6f6c6b697420546573742031",
expect: {commandQualifier: 0x80,
{command: "D01A" + // Length
"8103012101" + // Command details
"82028102" + // Device identities
"8D0F04546F6F6C6B697420546573742031", // Text string
expect: {commandQualifier: 0x01,
text: "Toolkit Test 1",
userClear: true}},
{command: "d01a8103012181820281028d0f04546f6f6c6b697420546573742032",
responseNeeded: false}},
{command: "D01C" + // Length
"8103012181" + // Command details
"82028102" + // Device identities
"8D0F04546F6F6C6B697420546573742032" + // Text string
"2B00", // Immediate response
expect: {commandQualifier: 0x81,
text: "Toolkit Test 2",
isHighPriority: true,
userClear: true}},
{command: "d0198103012180820281028d0e00d4f79bbd4ed341d4f29c0e9a01",
responseNeeded: true}},
{command: "D081AD" + // Length
"8103012180" + // Command details
"82028102" + // Device identities
"8D81A1045468697320636F6D6D616E6420696E73747275" + // Text string
"63747320746865204D4520746F20646973706C61792061" +
"2074657874206D6573736167652E20497420616C6C6F77" +
"73207468652053494D20746F20646566696E6520746865" +
"207072696F72697479206F662074686174206D65737361" +
"67652C20616E6420746865207465787420737472696E67" +
"20666F726D61742E2054776F207479706573206F662070" +
"72696F",
expect: {commandQualifier: 0x80,
text: "Toolkit Test 3",
userClear: true}},
{command: "d01a8103012100820281028d0f04546f6f6c6b697420546573742034",
expect: {commandQualifier: 0x00,
text: "Toolkit Test 4"}},
{command: "d081ad8103012180820281028d81a1045468697320636f6d6d616e6420696e7374727563747320746865204d4520746f20646973706c617920612074657874206d6573736167652e20497420616c6c6f7773207468652053494d20746f20646566696e6520746865207072696f72697479206f662074686174206d6573736167652c20616e6420746865207465787420737472696e6720666f726d61742e2054776f207479706573206f66207072696f",
expect: {commandQualifier: 0x80,
text: "This command instructs the ME to display a text message. It allows the SIM to define the priority of that message, and the text string format. Two types of prio",
userClear: true}},
{command: "d01a8103012180820281028d0f043c474f2d4241434b57415244533e",
text: "This command instructs the ME to display a text message. " +
"It allows the SIM to define the priority of that message," +
" and the text string format. Two types of prio",
responseNeeded: false}},
{command: "D01A" + // Length
"8103012180" + // Command details
"82028102" + // Device identities
"8D0F043C474F2D4241434B57415244533E", // Text string
expect: {commandQualifier: 0x80,
text: "<GO-BACKWARDS>",
userClear: true}},
{command: "d0248103012180820281028d1908041704140420041004120421042204120423041904220415",
responseNeeded: false}},
{command: "D024" + // Length
"8103012180" + // Command details
"82028102" + // Device identities
"8D19080417041404200410041204210422041204230419" + // Text string
"04220415",
expect: {commandQualifier: 0x80,
text: "ЗДРАВСТВУЙТЕ",
userClear: true}},
{command: "d0108103012180820281028d05084f60597d",
responseNeeded: false}},
{command: "D010" + // Length
"8103012180" + // Command details
"82028102" + // Device identities
"8D05084F60597D", // Text string
expect: {commandQualifier: 0x80,
text: "你好",
userClear: true}},
{command: "d0128103012180820281028d07080038003030eb",
expect: {commandQualifier: 0x80,
text: "80ル",
userClear: true}},
{command: "d0288103012180820281020d1d00d3309bfc06c95c301aa8e80259c3ec34b9ac07c9602f58ed159bb940",
responseNeeded: false}},
{command: "D028" + // Length
"8103012180" + // Command details
"82028102" + // Device identities
"0D1D00D3309BFC06C95C301AA8E80259C3EC34B9AC07C9" + // Text string
"602F58ED159BB940",
expect: {commandQualifier: 0x80,
text: "Saldo 2.04 E. Validez 20/05/13. ",
userClear: true}},
{command: "d0198103012180820281028D0A043130205365636F6E648402010A",
responseNeeded: false}},
{command: "D019" + // Length
"8103012180" + // Command details
"82028102" + // Device identities
"8D0A043130205365636F6E64" + // Text string
"8402010A", // Duration
expect: {commandQualifier: 0x80,
text: "10 Second",
userClear: true,
responseNeeded: false,
duration: {timeUnit: MozIccManager.STK_TIME_UNIT_SECOND,
timeInterval: 0x0A}}},
{command: "d01a8103012180820281028d0b0442617369632049636f6e9e020001",
{command: "D01A" + // Length
"8103012180" + // Command details
"82028102" + // Device identities
"8D0B0442617369632049636F6E" + // Text string
"9E020001", // Icon identifier
expect: {commandQualifier: 0x80,
text: "Basic Icon",
userClear: true,
responseNeeded: false,
iconSelfExplanatory: true,
icons: [BASIC_ICON]}},
{command: "D026810301210082028102" +
"8D" +
"1B" +
{command: "D026" + // Length
"8103012100" + // Command details
"82028102" + // Device identities
"8D1B" + // Text string
"00" + // 7BIT
"D4F79BBD4ED341D4F29C0E3A4A9F55A8" +
"0E8687C158A09B304905",
"D4F79BBD4ED341D4F29C0E3A4A9F55A80E8687C158A09B304905",
expect: {commandQualifier: 0x00,
text: "Toolkit Test GROUP:0x00, 7BIT"}},
{command: "D029810301210082028102" +
"8D" +
"1E" +
text: "Toolkit Test GROUP:0x00, 7BIT",
responseNeeded: false}},
{command: "D029" + // Length
"8103012100" + // Command details
"82028102" + // Device identities
"8D1E" + // Text string
"04" + // 8BIT
"546F6F6C6B697420546573742047524F" +
"55503A307830302C2038424954",
"546F6F6C6B697420546573742047524F55503A307830302C2038424954",
expect: {commandQualifier: 0x00,
text: "Toolkit Test GROUP:0x00, 8BIT"}},
{command: "D046810301210082028102" +
"8D" +
"3B" +
text: "Toolkit Test GROUP:0x00, 8BIT",
responseNeeded: false}},
{command: "D046" + // Length
"8103012100" + // Command details
"82028102" + // Device identities
"8D3B" + // Text string
"08" + // UCS2
"0054006F006F006C006B006900740020" +
"0054006500730074002000470052004F" +
"00550050003A0030007800300030002C" +
"00200055004300530032",
"0054006F006F006C006B0069007400200054006500730074002000470052004F" +
"00550050003A0030007800300030002C00200055004300530032",
expect: {commandQualifier: 0x00,
text: "Toolkit Test GROUP:0x00, UCS2"}},
{command: "D026810301210082028102" +
"8D" +
"1B" +
text: "Toolkit Test GROUP:0x00, UCS2",
responseNeeded: false}},
{command: "D026" + // Length
"8103012100" + // Command details
"82028102" + // Device identities
"8D1B" + // Text string
"12" + // 7BIT + Class 2
"D4F79BBD4ED341D4F29C0E3A4A9F55A8" +
"0E868FC158A09B304905",
"D4F79BBD4ED341D4F29C0E3A4A9F55A80E868FC158A09B304905",
expect: {commandQualifier: 0x00,
text: "Toolkit Test GROUP:0x10, 7BIT"}},
{command: "D029810301210082028102" +
"8D" +
"1E" +
text: "Toolkit Test GROUP:0x10, 7BIT",
responseNeeded: false}},
{command: "D029" + // Length
"8103012100" + // Command details
"82028102" + // Device identities
"8D1E" + // Text string
"16" + // 8BIT + Class 2
"546F6F6C6B697420546573742047524F" +
"55503A307831302C2038424954",
"546F6F6C6B697420546573742047524F55503A307831302C2038424954",
expect: {commandQualifier: 0x00,
text: "Toolkit Test GROUP:0x10, 8BIT"}},
{command: "D046810301210082028102" +
"8D" +
"3B" +
text: "Toolkit Test GROUP:0x10, 8BIT",
responseNeeded: false}},
{command: "D046" + // Length
"8103012100" + // Command details
"82028102" + // Device identities
"8D3B" + // Text string
"1A" + // UCS2 + Class 2
"0054006F006F006C006B006900740020" +
"0054006500730074002000470052004F" +
"00550050003A0030007800310030002C" +
"00200055004300530032",
"0054006F006F006C006B0069007400200054006500730074002000470052004F" +
"00550050003A0030007800310030002C00200055004300530032",
expect: {commandQualifier: 0x00,
text: "Toolkit Test GROUP:0x10, UCS2"}},
{command: "D026810301210082028102" +
"8D" +
"1B" +
text: "Toolkit Test GROUP:0x10, UCS2",
responseNeeded: false}},
{command: "D026" + // Length
"8103012100" + // Command details
"82028102" + // Device identities
"8D1B" + // Text string
"F2" + // 7BIT + Class 2
"D4F79BBD4ED341D4F29C0E3A4A9F55A8" +
"0E8637C258A09B304905",
"D4F79BBD4ED341D4F29C0E3A4A9F55A80E8637C258A09B304905",
expect: {commandQualifier: 0x00,
text: "Toolkit Test GROUP:0xF0, 7BIT"}},
{command: "D029810301210082028102" +
"8D" +
"1E" +
text: "Toolkit Test GROUP:0xF0, 7BIT",
responseNeeded: false}},
{command: "D029" + // Length
"8103012100" + // Command details
"82028102" + // Device identities
"8D1E" + // Text string
"F6" + // 8BIT + Class 2
"546F6F6C6B697420546573742047524F" +
"55503A307846302C2038424954",
"546F6F6C6B697420546573742047524F55503A307846302C2038424954",
expect: {commandQualifier: 0x00,
text: "Toolkit Test GROUP:0xF0, 8BIT"}},
text: "Toolkit Test GROUP:0xF0, 8BIT",
responseNeeded: false}},
// Bug 1088573: this test case is to ensure that we provide |length| argument
// in |integer| format to GsmPDUHelper.readSeptetsToString().
{command: "D0" +
"81" + // 2-byte length encoded:
"FC" + // 252
"810301210082028102" +
"8D" +
"81" + // 2-byte length encoded:
"F0" + // 240
{command: "D081FC" + // Length (2-byte length encoded: 252)
"8103012100" + // Command details
"82028102" + // Device identities
"8D" + // Text string
"81F0" + // 2-byte length encoded: 240
"00" + // 7BIT
"C332A85D9ECFC3E732685E068DDF6DF8" +
"7B5E0691CB20D96D061A87E5E131BD2C" +
"2FCF416537A8FD269741E3771B2E2FCF" +
"E76517685806B5CBF379F85C0695E774" +
"50D86C4E8FD165D0BC2E07C1D9F579BA" +
"5C97CF41E5B13CEC9E83CA7490BB0C22" +
"BFD374103C3C0795E9F232882E7FBBE3" +
"F5B20B24BBCD40E5391DC42E83DCEFB6" +
"585E06B5C3F874BBDE0691CBA071581E" +
"1ED3CBF2F21C14369BD3637458CC2EBB" +
"40C3329D5E0699DFEE313DFD76BBC3EC" +
"34BD0C0A83CAF432280C87CBDF757BB9" +
"0C8287E5207619346D1E73A0783D0D9A" +
"9FCA733A885C96BFEBEC32280C9A6689" +
"C332A85D9ECFC3E732685E068DDF6DF87B5E0691CB20D96D061A87E5E131BD2C" +
"2FCF416537A8FD269741E3771B2E2FCFE76517685806B5CBF379F85C0695E774" +
"50D86C4E8FD165D0BC2E07C1D9F579BA5C97CF41E5B13CEC9E83CA7490BB0C22" +
"BFD374103C3C0795E9F232882E7FBBE3F5B20B24BBCD40E5391DC42E83DCEFB6" +
"585E06B5C3F874BBDE0691CBA071581E1ED3CBF2F21C14369BD3637458CC2EBB" +
"40C3329D5E0699DFEE313DFD76BBC3EC34BD0C0A83CAF432280C87CBDF757BB9" +
"0C8287E5207619346D1E73A0783D0D9A9FCA733A885C96BFEBEC32280C9A6689" +
"CE621654768382D529551A64268B2E",
expect: {commandQualifier: 0x00,
text: "Ce message se compose de 273 caracteres en mode " +
@ -156,19 +182,26 @@ const TEST_DATA = [
"ecrans et ne doit pas etre tronque. 273 est le " +
"nombre maximum de caracteres affichable. Cette " +
"fonctionnalite a ete approuvee par le SMG9 qui s'est " +
"deroule a SYDNEY en AUSTRALIE."}},
"deroule a SYDNEY en AUSTRALIE.",
responseNeeded: false}},
];
function testDisplayText(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_DISPLAY_TEXT,
"typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
is(aCommand.options.text, aExpect.text, "options.text");
is(aCommand.options.userClear, aExpect.userClear, "options.userClear");
is(aCommand.options.isHighPriority, aExpect.isHighPriority,
"options.isHighPriority");
if (aExpect.duration) {
is(aCommand.options.userClear, !!(aExpect.commandQualifier & 0x80),
"options.userClear");
is(aCommand.options.isHighPriority, !!(aExpect.commandQualifier & 0x01),
"options.isHighPriority");
is(aCommand.options.text, aExpect.text, "options.text");
is(aCommand.options.responseNeeded, aExpect.responseNeeded,
"options.responseNeeded");
// duration is optional.
if ("duration" in aExpect) {
let duration = aCommand.options.duration;
is(duration.timeUnit, aExpect.duration.timeUnit,
"options.duration.timeUnit");
@ -176,7 +209,8 @@ function testDisplayText(aCommand, aExpect) {
"options.duration.timeInterval");
}
if (aExpect.icons) {
// icons is optional.
if ("icons" in aExpect) {
isIcons(aCommand.options.icons, aExpect.icons);
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
"options.iconSelfExplanatory");
@ -196,6 +230,12 @@ startTestCommon(function() {
// Wait onstkcommand event.
promises.push(waitForTargetEvent(icc, "stkcommand")
.then((aEvent) => testDisplayText(aEvent.command, data.expect)));
// Wait icc-stkcommand system message.
promises.push(waitForSystemMessage("icc-stkcommand")
.then((aMessage) => {
is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
testDisplayText(aMessage.command, data.expect);
}));
// Send emulator command to generate stk unsolicited event.
promises.push(sendEmulatorStkPdu(data.command));

Просмотреть файл

@ -5,54 +5,93 @@ MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "d0158103012200820281828d0a04456e74657220222b22",
expect: {commandQualifier: 0x00,
text: "Enter \"+\""}},
{command: "d0148103012200820281828d09004537bd2c07896022",
{command: "D014" + // Length
"8103012200" + // Command details
"82028182" + // Device identities
"8D09004537BD2C07896022", // Text string
expect: {commandQualifier: 0x00,
text: "Enter \"0\""}},
{command: "d01a8103012200820281828d0f043c474f2d4241434b57415244533e",
{command: "D00B" + // Length
"8103012200" + // Command details
"82028182" + // Device identities
"8D00", // Text string
expect: {commandQualifier: 0x00,
text: "<GO-BACKWARDS>"}},
{command: "d0138103012200820281828d08043c41424f52543e",
text: null}},
{command: "D00C" + // Length
"8103012200" + // Command details
"82028182" + // Device identities
"8D0100", // Text string
expect: {commandQualifier: 0x00,
text: "<ABORT>"}},
{command: "d0158103012201820281828d0a04456e74657220227122",
text: ""}},
{command: "D081AD" + // Length
"8103012201" + // Command details
"82028182" + // Device identities
"8D81A104456E746572202278222E205468697320636F6D" + // Text string
"6D616E6420696E7374727563747320746865204D452074" +
"6F20646973706C617920746578742C20616E6420746F20" +
"65787065637420746865207573657220746F20656E7465" +
"7220612073696E676C65206368617261637465722E2041" +
"6E7920726573706F6E736520656E746572656420627920" +
"7468652075736572207368616C6C206265207061737365" +
"642074",
expect: {commandQualifier: 0x01,
text: "Enter \"q\"",
isAlphabet: true}},
{command: "d081ad8103012201820281828d81a104456e746572202278222e205468697320636f6d6d616e6420696e7374727563747320746865204d4520746f20646973706c617920746578742c20616e6420746f2065787065637420746865207573657220746f20656e74657220612073696e676c65206368617261637465722e20416e7920726573706f6e736520656e7465726564206279207468652075736572207368616c6c206265207061737365642074",
expect: {commandQualifier: 0x01,
text: "Enter \"x\". This command instructs the ME to display text, and to expect the user to enter a single character. Any response entered by the user shall be passed t",
isAlphabet: true}},
{command: "d0168103012200820281828d0b043c54494d452d4f55543e",
text: "Enter \"x\". This command instructs the ME to display " +
"text, and to expect the user to enter a single character. " +
"Any response entered by the user shall be passed t"}},
{command: "D016" + // Length
"8103012200" + // Command details
"82028182" + // Device identities
"8D0B043C54494D452D4F55543E", // Text string
expect: {commandQualifier: 0x00,
text: "<TIME-OUT>"}},
{command: "d0248103012200820281828d1908041704140420041004120421042204120423041904220415",
{command: "D08199" + // Length
"8103012200" + // Command details
"82028182" + // Device identities
"8D818D0804170414042004100412042104220412042304" + // Text string
"1904220415041704140420041004120421042204120423" +
"0419042204150417041404200410041204210422041204" +
"2304190422041504170414042004100412042104220412" +
"0423041904220415041704140420041004120421042204" +
"1204230419042204150417041404200410041204210422" +
"041204230419",
expect: {commandQualifier: 0x00,
text: "ЗДРАВСТВУЙТЕ"}},
{command: "d081998103012200820281828d818d080417041404200410041204210422041204230419042204150417041404200410041204210422041204230419042204150417041404200410041204210422041204230419042204150417041404200410041204210422041204230419042204150417041404200410041204210422041204230419042204150417041404200410041204210422041204230419",
expect: {commandQualifier: 0x00,
text: "ЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙ"}},
{command: "d0118103012203820281828d0604456e746572",
text: "ЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДР" +
"АВСТВУЙТЕЗДРАВСТВУЙ"}},
{command: "D011" + // Length
"8103012203" + // Command details
"82028182" + // Device identities
"8D0604456E746572", // Text string
expect: {commandQualifier: 0x03,
text: "Enter",
isAlphabet: true,
isUCS2: true}},
{command: "d0158103012204820281828d0a04456e74657220594553",
text: "Enter"}},
{command: "D015" + // Length
"8103012204" + // Command details
"82028182" + // Device identities
"8D0A04456E74657220594553", // Text string
expect: {commandQualifier: 0x04,
text: "Enter YES",
isYesNoRequested: true}},
{command: "d0148103012204820281828d0904456e746572204e4f",
expect: {commandQualifier: 0x04,
text: "Enter NO",
isYesNoRequested: true}},
{command: "d0198103012200820281828d0a043c4e4f2d49434f4e3e1e020002",
text: "Enter YES"}},
{command: "D019" + // Length
"8103012200" + // Command details
"82028182" + // Device identities
"8D0A043C4E4F2D49434F4E3E" + // Text string
"1E020002", // Icon identifier
expect: {commandQualifier: 0x00,
// The record number 02 in EFimg is not defined, so no icon will be
// shown, but the text string should still be displayed.
text: "<NO-ICON>"}},
{command: "D0198103012200820281828D0A04456E74657220222B228402010A",
{command: "D016" + // Length
"8103012280" + // Command details
"82028182" + // Device identities
"8D07043C49434F4E3E" + // Text string
"1E020101", // Icon identifier
expect: {commandQualifier: 0x80,
text: "<ICON>",
iconSelfExplanatory: false,
icons : [BASIC_ICON]}},
{command: "D019" + // Length
"8103012200" + // Command details
"82028182" + // Device identities
"8D0A04456E74657220222B22" + // Text string
"8402010A", // Duration
expect: {commandQualifier: 0x00,
text: "Enter \"+\"",
duration: {timeUnit: MozIccManager.STK_TIME_UNIT_SECOND,
@ -60,15 +99,24 @@ const TEST_DATA = [
];
function testGetInKey(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_GET_INKEY, "typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
is(aCommand.options.text, aExpect.text, "options.text");
is(aCommand.options.isAlphabet, aExpect.isAlphabet, "options.isAlphabet");
is(aCommand.options.isUCS2, aExpect.isUCS2, "options.isUCS2");
is(aCommand.options.isYesNoRequested, aExpect.isYesNoRequested,
"options.isYesNoRequested");
if (aExpect.duration) {
is(aCommand.options.isAlphabet, !!(aExpect.commandQualifier & 0x01),
"options.isAlphabet");
is(aCommand.options.isUCS2, !!(aExpect.commandQualifier & 0x02),
"options.isUCS2");
is(aCommand.options.isYesNoRequested, !!(aExpect.commandQualifier & 0x04),
"options.isYesNoRequested");
is(aCommand.options.isHelpAvailable, !!(aExpect.commandQualifier & 0x80),
"options.isHelpAvailable");
is(aCommand.options.text, aExpect.text, "options.text");
is(aCommand.options.minLength, 1, "options.minLength");
is(aCommand.options.maxLength, 1, "options.maxLength");
// duration is optional.
if ("duration" in aExpect) {
let duration = aCommand.options.duration;
is(duration.timeUnit, aExpect.duration.timeUnit,
"options.duration.timeUnit");
@ -76,7 +124,8 @@ function testGetInKey(aCommand, aExpect) {
"options.duration.timeInterval");
}
if (aExpect.icons) {
// icons is optional.
if ("icons" in aExpect) {
isIcons(aCommand.options.icons, aExpect.icons);
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
"options.iconSelfExplanatory");
@ -96,6 +145,12 @@ startTestCommon(function() {
// Wait onstkcommand event.
promises.push(waitForTargetEvent(icc, "stkcommand")
.then((aEvent) => testGetInKey(aEvent.command, data.expect)));
// Wait icc-stkcommand system message.
promises.push(waitForSystemMessage("icc-stkcommand")
.then((aMessage) => {
is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
testGetInKey(aMessage.command, data.expect);
}));
// Send emulator command to generate stk unsolicited event.
promises.push(sendEmulatorStkPdu(data.command));

Просмотреть файл

@ -5,106 +5,135 @@ MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "d01b8103012300820281828d0c04456e74657220313233343591020505",
{command: "D01B" + // Length
"8103012300" + // Command details
"82028182" + // Device identities
"8D0C04456E746572203132333435" + // Text string
"91020505", // Response length
expect: {commandQualifier: 0x00,
text: "Enter 12345",
minLength: 5,
maxLength: 5}},
{command: "d01a8103012308820281828d0b004537bd2c07d96eaad10a91020505",
{command: "D01A" + // Length
"8103012308" + // Command details
"82028182" + // Device identities
"8D0B004537BD2C07D96EAAD10A" + // Text string
"91020505", // Response length
expect: {commandQualifier: 0x08,
text: "Enter 67*#+",
minLength: 5,
maxLength: 5,
isPacked: true}},
{command: "d01b8103012301820281828d0c04456e74657220416243644591020505",
maxLength: 5}},
{command: "D01B" + // Length
"8103012301" + // Command details
"82028182" + // Device identities
"8D0C04456E746572204162436445" + // Text string
"91020505", // Response length
expect: {commandQualifier: 0x01,
text: "Enter AbCdE",
minLength: 5,
maxLength: 5,
isAlphabet: true}},
{command: "d0278103012304820281828d180450617373776f726420313c53454e443e3233343536373891020408",
maxLength: 5}},
{command: "D027" + // Length
"8103012304" + // Command details
"82028182" + // Device identities
"8D180450617373776F726420313C53454E443E323334" + // Text string
"35363738" +
"91020408", // Response length
expect: {commandQualifier: 0x04,
text: "Password 1<SEND>2345678",
minLength: 4,
maxLength: 8,
hideInput: true}},
{command: "d0248103012300820281828d1504456e74657220312e2e392c302e2e392c3028312991020114",
expect: {commandQualifier: 0x00,
text: "Enter 1..9,0..9,0(1)",
minLength: 1,
maxLength: 20}},
{command: "d01e8103012300820281828d0f043c474f2d4241434b57415244533e91020008",
maxLength: 8}},
{command: "D01E" + // Length
"8103012300" + // Command details
"82028182" + // Device identities
"8D0F043C474F2D4241434B57415244533E" + // Text string
"91020008", // Response length
expect: {commandQualifier: 0x00,
text: "<GO-BACKWARDS>",
minLength: 0,
maxLength: 8}},
{command: "d0178103012300820281828d08043c41424f52543e91020008",
{command: "D081B1" + // Length
"8103012300" + // Command details
"82028182" + // Device identities
"8D81A1042A2A2A313131313131313131312323232A2A2A" + // Text string
"323232323232323232322323232A2A2A33333333333333" +
"3333332323232A2A2A343434343434343434342323232A" +
"2A2A353535353535353535352323232A2A2A3636363636" +
"36363636362323232A2A2A373737373737373737372323" +
"232A2A2A383838383838383838382323232A2A2A393939" +
"393939393939392323232A2A2A30303030303030303030" +
"232323" +
"9102A0A0", // Response length
expect: {commandQualifier: 0x00,
text: "<ABORT>",
minLength: 0,
maxLength: 8}},
{command: "d081b18103012300820281828d81a1042a2a2a313131313131313131312323232a2a2a323232323232323232322323232a2a2a333333333333333333332323232a2a2a343434343434343434342323232a2a2a353535353535353535352323232a2a2a363636363636363636362323232a2a2a373737373737373737372323232a2a2a383838383838383838382323232a2a2a393939393939393939392323232a2a2a303030303030303030302323239102a0a0",
expect: {commandQualifier: 0x00,
text: "***1111111111###***2222222222###***3333333333###***4444444444###***5555555555###***6666666666###***7777777777###***8888888888###***9999999999###***0000000000###",
text: "***1111111111###***2222222222###***3333333333###***444444" +
"4444###***5555555555###***6666666666###***7777777777###**" +
"*8888888888###***9999999999###***0000000000###",
minLength: 160,
maxLength: 160}},
{command: "d0168103012300820281828d07043c53454e443e91020001",
expect: {commandQualifier: 0x00,
text: "<SEND>",
minLength: 0,
maxLength: 1}},
{command: "d01a8103012300820281828d0b043c54494d452d4f55543e9102000a",
expect: {commandQualifier: 0x00,
text: "<TIME-OUT>",
minLength: 0,
maxLength: 10}},
{command: "d0288103012301820281828d190804170414042004100412042104220412042304190422041591020505",
{command: "D0819D" + // Length
"8103012301" + // Command details
"82028182" + // Device identities
"8D818D0804170414042004100412042104220412042304" + // Text string
"1904220415041704140420041004120421042204120423" +
"0419042204150417041404200410041204210422041204" +
"2304190422041504170414042004100412042104220412" +
"0423041904220415041704140420041004120421042204" +
"1204230419042204150417041404200410041204210422" +
"041204230419" +
"91020505", // Response length
expect: {commandQualifier: 0x01,
text: "ЗДРАВСТВУЙТЕ",
text: "ЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУ" +
"ЙТЕЗДРАВСТВУЙ",
minLength: 5,
maxLength: 5,
isAlphabet: true}},
{command: "d0819d8103012301820281828d818d08041704140420041004120421042204120423041904220415041704140420041004120421042204120423041904220415041704140420041004120421042204120423041904220415041704140420041004120421042204120423041904220415041704140420041004120421042204120423041904220415041704140420041004120421042204120423041991020505",
expect: {commandQualifier: 0x01,
text: "ЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙ",
minLength: 5,
maxLength: 5,
isAlphabet: true}},
{command: "d01b8103012303820281828d0c04456e7465722048656c6c6f91020c0c",
expect: {commandQualifier: 0x03,
text: "Enter Hello",
minLength: 12,
maxLength: 12,
isAlphabet: true,
isUCS2: true}},
{command: "d01b8103012303820281828d0c04456e7465722048656c6c6f910205ff",
maxLength: 5}},
{command: "D01B" + // Length
"8103012303" + // Command details
"82028182" + // Device identities
"8D0C04456E7465722048656C6C6F" + // Text string
"910205FF", // Response length
expect: {commandQualifier: 0x03,
text: "Enter Hello",
minLength: 5,
maxLength: 0xFF,
isAlphabet: true,
isUCS2: true}},
{command: "d0238103012300820281828d0c04456e746572203132333435910205051706043132333435",
expect: {commandQualifier: 0x00,
text: "Enter 12345",
minLength: 5,
maxLength: 5,
defaultText: "12345"}},
{command: "d081ba8103012300820281828d0704456e7465723a9102a0a01781a1042a2a2a313131313131313131312323232a2a2a323232323232323232322323232a2a2a333333333333333333332323232a2a2a343434343434343434342323232a2a2a353535353535353535352323232a2a2a363636363636363636362323232a2a2a373737373737373737372323232a2a2a383838383838383838382323232a2a2a393939393939393939392323232a2a2a30303030303030303030232323",
maxLength: 0xFF}},
{command: "D081BA" + // Length
"8103012300" + // Command details
"82028182" + // Device identities
"8D0704456E7465723A" + // Text string
"9102A0A0" + // Response length
"1781A1042A2A2A313131313131313131312323232A2A2A" + // Default text
"323232323232323232322323232A2A2A33333333333333" +
"3333332323232A2A2A343434343434343434342323232A" +
"2A2A353535353535353535352323232A2A2A3636363636" +
"36363636362323232A2A2A373737373737373737372323" +
"232A2A2A383838383838383838382323232A2A2A393939" +
"393939393939392323232A2A2A30303030303030303030" +
"232323",
expect: {commandQualifier: 0x00,
text: "Enter:",
minLength: 160,
maxLength: 160,
defaultText: "***1111111111###***2222222222###***3333333333###***4444444444###***5555555555###***6666666666###***7777777777###***8888888888###***9999999999###***0000000000###"}},
{command: "d01d8103012300820281828d0a043c4e4f2d49434f4e3e9102000a1e020002",
defaultText: "***1111111111###***2222222222###***3333333333###**" +
"*4444444444###***5555555555###***6666666666###***7" +
"777777777###***8888888888###***9999999999###***000" +
"0000000###"}},
{command: "D01D" + // Length
"8103012300" + // Command details
"82028182" + // Device identities
"8D0A043C4E4F2D49434F4E3E" + // Text string
"9102000A" + // Response length
"1E020002", // Icon identifier
expect: {commandQualifier: 0x00,
// The record number 02 in EFimg is not defined, so no icon will be
// shown, but the text string should still be displayed.
text: "<NO-ICON>",
minLength: 0,
maxLength: 10}},
{command: "d0208103012300820281828d0d043c42415349432d49434f4e3e9102000a1e020101",
expect: {commandQualifier: 0x00,
{command: "D020" + // Length
"8103012380" + // Command details
"82028182" + // Device identities
"8D0D043C42415349432D49434F4E3E" + // Text string
"9102000A" + // Response length
"1E020101", // Icon identifier
expect: {commandQualifier: 0x80,
text: "<BASIC-ICON>",
minLength: 0,
maxLength: 10,
@ -113,33 +142,31 @@ const TEST_DATA = [
];
function testGetInput(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_GET_INPUT, "typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
is(aCommand.options.isAlphabet, !!(aExpect.commandQualifier & 0x01),
"options.isAlphabet");
is(aCommand.options.isUCS2, !!(aExpect.commandQualifier & 0x02),
"options.isUCS2");
is(aCommand.options.hideInput, !!(aExpect.commandQualifier & 0x04),
"options.hideInput");
is(aCommand.options.isPacked, !!(aExpect.commandQualifier & 0x08),
"options.isPacked");
is(aCommand.options.isHelpAvailable, !!(aExpect.commandQualifier & 0x80),
"options.isHelpAvailable");
is(aCommand.options.text, aExpect.text, "options.text");
is(aCommand.options.minLength, aExpect.minLength, "options.minLength");
is(aCommand.options.maxLength, aExpect.maxLength, "options.maxLength");
if (aExpect.defaultText) {
// defaultText is optional.
if ("defaultText" in aExpect) {
is(aCommand.options.defaultText, aExpect.defaultText, "options.defaultText");
}
if (aExpect.isAlphabet) {
is(aCommand.options.isAlphabet, aExpect.isAlphabet, "options.isAlphabet");
}
if (aExpect.isUCS2) {
is(aCommand.options.isUCS2, aExpect.isUCS2, "options.isUCS2");
}
if (aExpect.isPacked) {
is(aCommand.options.isPacked, aExpect.isPacked, "options.isPacked");
}
if (aExpect.hideInput) {
is(aCommand.options.hideInput, aExpect.hideInput, "options.hideInput");
}
if (aExpect.icons) {
// icons is optional.
if ("icons" in aExpect) {
isIcons(aCommand.options.icons, aExpect.icons);
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
"options.iconSelfExplanatory");
@ -159,6 +186,12 @@ startTestCommon(function() {
// Wait onstkcommand event.
promises.push(waitForTargetEvent(icc, "stkcommand")
.then((aEvent) => testGetInput(aEvent.command, data.expect)));
// Wait icc-stkcommand system message.
promises.push(waitForSystemMessage("icc-stkcommand")
.then((aMessage) => {
is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
testGetInput(aMessage.command, data.expect);
}));
// Send emulator command to generate stk unsolicited event.
promises.push(sendEmulatorStkPdu(data.command));

Просмотреть файл

@ -5,181 +5,118 @@ MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "d0188103011500820281823100050b44656661756c742055524c",
{command: "D018" + // Length
"8103011500" + // Command details
"82028182" + // Device identities
"3100" + // URL
"050B44656661756C742055524C", // Alpha identifier
expect: {commandQualifier: 0x00,
url: "",
mode: MozIccManager.STK_BROWSER_MODE_LAUNCH_IF_NOT_ALREADY_LAUNCHED,
confirmMessage: { text: "Default URL" }}},
{command: "d01f8103011500820281823112687474703a2f2f7878782e7979792e7a7a7a0500",
{command: "D01F" + // Length
"8103011500" + // Command details
"82028182" + // Device identities
"3112687474703A2F2F7878782E7979792E7A7A7A" + // URL
"0500", // Alpha identifier
expect: {commandQualifier: 0x00,
url: "http://xxx.yyy.zzz",
mode: MozIccManager.STK_BROWSER_MODE_LAUNCH_IF_NOT_ALREADY_LAUNCHED,
confirmMessage: { text: "" }}},
{command: "d00e8103011500820281823001003100",
{command: "D023" + // Length
"8103011500" + // Command details
"82028182" + // Device identities
"300100" + // Browser identity
"3100" + // URL
"320103" + // Bear
"0D10046162632E6465662E6768692E6A6B6C", // Text string
expect: {commandQualifier: 0x00,
url: ""}},
{command: "d0208103011500820281823100320103" +
"0d10046162632e6465662e6768692e6a6b6c", // "0D" String TLV is useless for Launch Browser.
expect: {commandQualifier: 0x00,
url: ""}},
{command: "d0188103011502820281823100050b44656661756c742055524c",
// Browser identity, Bear and Text string are useless.
url: "",
mode: MozIccManager.STK_BROWSER_MODE_LAUNCH_IF_NOT_ALREADY_LAUNCHED}},
{command: "D018" + // Length
"8103011502" + // Command details
"82028182" + // Device identities
"3100" + // URL
"050B44656661756C742055524C", // Alpha identifier
expect: {commandQualifier: 0x02,
url: "",
mode: MozIccManager.STK_BROWSER_MODE_USING_EXISTING_BROWSER,
confirmMessage: { text: "Default URL" }}},
{command: "d0188103011503820281823100050b44656661756c742055524c",
{command: "D018" + // Length
"8103011503" + // Command details
"82028182" + // Device identities
"3100" + // URL
"050B44656661756C742055524C", // Alpha identifier
expect: {commandQualifier: 0x03,
url: "",
mode: MozIccManager.STK_BROWSER_MODE_USING_NEW_BROWSER,
confirmMessage: { text: "Default URL"}}},
{command: "d00b8103011500820281823100",
expect: {commandQualifier: 0x00,
url: ""}},
{command: "d0268103011502820281823100051980041704140420041004120421042204120423041904220415",
{command: "D026" + // Length
"8103011502" + // Command details
"82028182" + // Device identities
"3100" + // URL
"051980041704140420041004120421042204120423" + // Alpha identifier
"041904220415",
expect: {commandQualifier: 0x02,
url: "",
mode: MozIccManager.STK_BROWSER_MODE_USING_EXISTING_BROWSER,
confirmMessage: { text: "ЗДРАВСТВУЙТЕ" }}},
{command: "d021810301150282028182310005104e6f742073656c66206578706c616e2e1e020101",
{command: "D021" + // Length
"8103011502" + // Command details
"82028182" + // Device identities
"3100" + // URL
"05104E6F742073656C66206578706C616E2E" + // Alpha identifier
"1E020101", // Icon identifier
expect: {commandQualifier: 0x02,
url: "",
mode: MozIccManager.STK_BROWSER_MODE_USING_EXISTING_BROWSER,
confirmMessage: { text: "Not self explan.",
iconSelfExplanatory: false,
icons : [BASIC_ICON] }
}},
{command: "d01d8103011502820281823100050c53656c66206578706c616e2e1e020001",
expect: {commandQualifier: 0x02,
url: "",
confirmMessage: { text: "Self explan.",
iconSelfExplanatory: true,
icons : [BASIC_ICON] }
}},
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d00b4",
expect: {commandQualifier: 0x00,
url: "",
confirmMessage: { text: "Default URL 1" }}},
{command: "d01a8103011500820281823100050d44656661756c742055524c2032",
expect: {commandQualifier: 0x00,
url: "",
confirmMessage: { text: "Default URL 2" }}},
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d01b4",
expect: {commandQualifier: 0x00,
url: "",
confirmMessage: { text: "Default URL 1" }}},
{command: "d01a8103011500820281823100050d44656661756c742055524c2032",
expect: {commandQualifier: 0x00,
url: "",
confirmMessage: { text: "Default URL 2" }}},
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d02b4",
expect: {commandQualifier: 0x00,
url: "",
confirmMessage: { text: "Default URL 1" }}},
{command: "d01a8103011500820281823100050d44656661756c742055524c2032",
expect: {commandQualifier: 0x00,
url: "",
confirmMessage: { text: "Default URL 2" }}},
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d04b4",
expect: {commandQualifier: 0x00,
url: "",
confirmMessage: { text: "Default URL 1" }}},
{command: "d0208103011500820281823100050d44656661756c742055524c2032d004000d00b4",
expect: {commandQualifier: 0x00,
url: "",
confirmMessage: { text: "Default URL 2" }}},
{command: "d01a8103011500820281823100050d44656661756c742055524c2033",
expect: {commandQualifier: 0x00,
url: "",
confirmMessage: { text: "Default URL 3" }}},
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d08b4",
expect: {commandQualifier: 0x00,
url: "",
confirmMessage: { text: "Default URL 1" }}},
{command: "d0208103011500820281823100050d44656661756c742055524c2032d004000d00b4",
expect: {commandQualifier: 0x00,
url: "",
confirmMessage: { text: "Default URL 2" }}},
{command: "d01a8103011500820281823100050d44656661756c742055524c2033",
expect: {commandQualifier: 0x00,
url: "",
confirmMessage: { text: "Default URL 3" }}},
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d10b4",
expect: {commandQualifier: 0x00,
url: "",
confirmMessage: { text: "Default URL 1" }}},
{command: "d0208103011500820281823100050d44656661756c742055524c2032d004000d00b4",
expect: {commandQualifier: 0x00,
url: "",
confirmMessage: { text: "Default URL 2" }}},
{command: "d01a8103011500820281823100050d44656661756c742055524c2033",
expect: {commandQualifier: 0x00,
url: "",
confirmMessage: { text: "Default URL 3" }}},
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d20b4",
expect: {commandQualifier: 0x00,
url: "",
confirmMessage: { text: "Default URL 1" }}},
{command: "d0208103011500820281823100050d44656661756c742055524c2032d004000d00b4",
expect: {commandQualifier: 0x00,
url: "",
confirmMessage: { text: "Default URL 2" }}},
{command: "d01a8103011500820281823100050d44656661756c742055524c2033",
expect: {commandQualifier: 0x00,
url: "",
confirmMessage: { text: "Default URL 3" }}},
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d40b4",
expect: {commandQualifier: 0x00,
url: "",
confirmMessage: { text: "Default URL 1" }}},
{command: "d0208103011500820281823100050d44656661756c742055524c2032d004000d00b4",
expect: {commandQualifier: 0x00,
url: "",
confirmMessage: { text: "Default URL 2" }}},
{command: "d01a8103011500820281823100050d44656661756c742055524c2033",
expect: {commandQualifier: 0x00,
url: "",
confirmMessage: { text: "Default URL 3" }}},
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d80b4",
expect: {commandQualifier: 0x00,
url: "",
confirmMessage: { text: "Default URL 1" }}},
{command: "d0208103011500820281823100050d44656661756c742055524c2032d004000d00b4",
expect: {commandQualifier: 0x00,
url: "",
confirmMessage: { text: "Default URL 2" }}},
{command: "d01a8103011500820281823100050d44656661756c742055524c2033",
expect: {commandQualifier: 0x00,
url: "",
confirmMessage: { text: "Default URL 3" }}},
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d00b4",
expect: {commandQualifier: 0x00,
url: "",
confirmMessage: { text: "Default URL 1" }}},
{command: "d01a8103011500820281823100050d44656661756c742055524c2032",
expect: {commandQualifier: 0x00,
url: "",
confirmMessage: { text: "Default URL 2" }}},
{command: "d01281030115028202818231000505804f60597d",
{command: "D012" + // Length
"8103011502" + // Command details
"82028182" + // Device identities
"3100" + // URL
"0505804F60597D", // Alpha identifier
expect: {commandQualifier: 0x02,
url: "",
mode: MozIccManager.STK_BROWSER_MODE_USING_EXISTING_BROWSER,
confirmMessage: { text: "你好" }}},
{command: "d010810301150282028182310005038030eb",
expect: {commandQualifier: 0x02,
url: "",
confirmMessage: { text: "ル" }}},
{command: "d01281030115008202818230010031001e020001",
{command: "D00F" + // Length
"8103011500" + // Command details
"82028182" + // Device identities
"3100" + // URL
"1E020001", // Icon identifier
expect: {commandQualifier: 0x00,
url: "",
mode: MozIccManager.STK_BROWSER_MODE_LAUNCH_IF_NOT_ALREADY_LAUNCHED,
confirmMessage: { iconSelfExplanatory: true,
icons: [BASIC_ICON] }}},
{command: "d01281030115008202818230010031001e020003",
{command: "D00F" + // Length
"8103011500" + // Command details
"82028182" + // Device identities
"3100" + // URL
"1E020003", // Icon identifier
expect: {commandQualifier: 0x00,
url: "",
mode: MozIccManager.STK_BROWSER_MODE_LAUNCH_IF_NOT_ALREADY_LAUNCHED,
confirmMessage: { iconSelfExplanatory: true,
icons: [COLOR_ICON] }}},
];
function testLaunchBrowser(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_LAUNCH_BROWSER,
"typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
is(aCommand.options.url, aExpect.url, "options.url");
if (aExpect.confirmMessage) {
is(aCommand.options.url, aExpect.url, "options.url");
is(aCommand.options.mode, aExpect.mode, "options.mode");
// confirmMessage is optional
if ("confirmMessage" in aExpect) {
isStkText(aCommand.options.confirmMessage, aExpect.confirmMessage,
"options.confirmMessage");
}
@ -198,6 +135,12 @@ startTestCommon(function() {
// Wait onstkcommand event.
promises.push(waitForTargetEvent(icc, "stkcommand")
.then((aEvent) => testLaunchBrowser(aEvent.command, data.expect)));
// Wait icc-stkcommand system message.
promises.push(waitForSystemMessage("icc-stkcommand")
.then((aMessage) => {
is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
testLaunchBrowser(aMessage.command, data.expect);
}));
// Send emulator command to generate stk unsolicited event.
promises.push(sendEmulatorStkPdu(data.command));

Просмотреть файл

@ -6,31 +6,38 @@ MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
// Location
{command: "d009810301260082028182",
expect: {commandNumber: 0x01,
commandQualifier: MozIccManager.STK_LOCAL_INFO_LOCATION_INFO,
{command: "D009" + // Length
"8103012600" + // Command details
"82028182", // Device identities
expect: {commandQualifier: MozIccManager.STK_LOCAL_INFO_LOCATION_INFO,
localInfoType: MozIccManager.STK_LOCAL_INFO_LOCATION_INFO}},
// Imei
{command: "d009810301260182028182",
expect: {commandNumber: 0x01,
commandQualifier: MozIccManager.STK_LOCAL_INFO_IMEI,
{command: "D009" + // Length
"8103012601" + // Command details
"82028182", // Device identities
expect: {commandQualifier: MozIccManager.STK_LOCAL_INFO_IMEI,
localInfoType: MozIccManager.STK_LOCAL_INFO_IMEI}},
// Data
{command: "d009810301260382028182",
expect: {commandNumber: 0x01,
commandQualifier: MozIccManager.STK_LOCAL_INFO_DATE_TIME_ZONE,
{command: "D009" + // Length
"8103012603" + // Command details
"82028182", // Device identities
expect: {commandQualifier: MozIccManager.STK_LOCAL_INFO_DATE_TIME_ZONE,
localInfoType: MozIccManager.STK_LOCAL_INFO_DATE_TIME_ZONE}},
// Language
{command: "d009810301260482028182",
expect: {commandNumber: 0x01,
commandQualifier: MozIccManager.STK_LOCAL_INFO_LANGUAGE,
{command: "D009" + // Length
"8103012604" + // Command details
"82028182", // Device identities
expect: {commandQualifier: MozIccManager.STK_LOCAL_INFO_LANGUAGE,
localInfoType: MozIccManager.STK_LOCAL_INFO_LANGUAGE}},
];
function testLocalInfo(aCommand, aExpect) {
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO, "typeOfCommand");
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO,
"typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
is(aCommand.options.localInfoType, aExpect.localInfoType, "options.localInfoType");
is(aCommand.options.localInfoType, aExpect.localInfoType,
"options.localInfoType");
}
// Start tests
@ -46,6 +53,12 @@ startTestCommon(function() {
// Wait onstkcommand event.
promises.push(waitForTargetEvent(icc, "stkcommand")
.then((aEvent) => testLocalInfo(aEvent.command, data.expect)));
// Wait icc-stkcommand system message.
promises.push(waitForSystemMessage("icc-stkcommand")
.then((aMessage) => {
is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
testLocalInfo(aMessage.command, data.expect);
}));
// Send emulator command to generate stk unsolicited event.
promises.push(sendEmulatorStkPdu(data.command));

Просмотреть файл

@ -0,0 +1,120 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "D009" + // Length
"8103012000" + // Command details
"82028182", // Device identities
expect: {commandQualifier: 0x00}},
{command: "D014" + // Length
"8103012001" + // Command details
"82028182" + // Device identities
"8509506C617920546F6E65", // Alpha identifier
expect: {commandQualifier: 0x01,
text: "Play Tone"}},
{command: "D00B" + // Length
"8103012001" + // Command details
"82028182" + // Device identities
"8500", // Alpha identifier
expect: {commandQualifier: 0x01,
text: ""}},
{command: "D00C" + // Length
"8103012000" + // Command details
"82028182" + // Device identities
"8E0101", // Tone
expect: {commandQualifier: 0x00,
tone: 0x01}},
{command: "D00D" + // Length
"8103012000" + // Command details
"82028182" + // Device identities
"84020205", // Duration
expect: {commandQualifier: 0x00,
duration: {timeUnit: MozIccManager.STK_TIME_UNIT_TENTH_SECOND,
timeInterval: 0x05}}},
{command: "D00D" + // Length
"8103012000" + // Command details
"82028182" + // Device identities
"1E020101", // Icon identifier
expect: {commandQualifier: 0x00,
iconSelfExplanatory: false,
icons: [BASIC_ICON]}},
{command: "D01F" + // Length
"8103012001" + // Command details
"82028182" + // Device identities
"8509506C617920546F6E65" + // Alpha identifier
"8E0101" + // Tone
"84020202" + // Duration
"1E020003", // Icon identifier
expect: {commandQualifier: 0x01,
text: "Play Tone",
duration: {timeUnit: MozIccManager.STK_TIME_UNIT_TENTH_SECOND,
timeInterval: 0x02},
iconSelfExplanatory: true,
icons: [COLOR_ICON]}},
];
function testPlayTone(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_PLAY_TONE, "typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
is(aCommand.options.isVibrate, !!(aExpect.commandQualifier & 0x01),
"options.isVibrate");
// text is optional.
if ("text" in aExpect) {
is(aCommand.options.text, aExpect.text, "options.text");
}
// tone is optional.
if ("tone" in aExpect) {
is(aCommand.options.tone, aExpect.tone, "options.tone");
}
// duration is optional.
if ("duration" in aExpect) {
let duration = aCommand.options.duration;
is(duration.timeUnit, aExpect.duration.timeUnit,
"options.duration.timeUnit");
is(duration.timeInterval, aExpect.duration.timeInterval,
"options.duration.timeInterval");
}
// icons is optional.
if ("icons" in aExpect) {
isIcons(aCommand.options.icons, aExpect.icons);
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
"options.iconSelfExplanatory");
}
}
// Start tests
startTestCommon(function() {
let icc = getMozIcc();
let promise = Promise.resolve();
for (let i = 0; i < TEST_DATA.length; i++) {
let data = TEST_DATA[i];
promise = promise.then(() => {
log("play_tone_cmd: " + data.command);
let promises = [];
// Wait onstkcommand event.
promises.push(waitForTargetEvent(icc, "stkcommand")
.then((aEvent) => testPlayTone(aEvent.command, data.expect)));
// Wait icc-stkcommand system message.
promises.push(waitForSystemMessage("icc-stkcommand")
.then((aMessage) => {
is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
testPlayTone(aMessage.command, data.expect);
}));
// Send emulator command to generate stk unsolicited event.
promises.push(sendEmulatorStkPdu(data.command));
return Promise.all(promises);
});
}
return promise;
});

Просмотреть файл

@ -0,0 +1,68 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "D00D" + // Length
"8103010300" + // Command details
"82028182" + // Device identities
"8402001A", // Duration
expect: {commandQualifier: 0x00,
timeUnit: MozIccManager.STK_TIME_UNIT_MINUTE,
timeInterval: 0x1A}},
{command: "D00D" + // Length
"8103010300" + // Command details
"82028182" + // Device identities
"8402010A", // Duration
expect: {commandQualifier: 0x00,
timeUnit: MozIccManager.STK_TIME_UNIT_SECOND,
timeInterval: 0x0A}},
{command: "D00D" + // Length
"8103010300" + // Command details
"82028182" + // Device identities
"84020205", // Duration
expect: {commandQualifier: 0x00,
timeUnit: MozIccManager.STK_TIME_UNIT_TENTH_SECOND,
timeInterval: 0x05}},
];
function testPollOff(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_POLL_INTERVAL,
"typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
is(aCommand.options.timeUnit, aExpect.timeUnit,
"options.timeUnit");
is(aCommand.options.timeInterval, aExpect.timeInterval,
"options.timeInterval");
}
// Start tests
startTestCommon(function() {
let icc = getMozIcc();
let promise = Promise.resolve();
for (let i = 0; i < TEST_DATA.length; i++) {
let data = TEST_DATA[i];
promise = promise.then(() => {
log("poll_interval_cmd: " + data.command);
let promises = [];
// Wait onstkcommand event.
promises.push(waitForTargetEvent(icc, "stkcommand")
.then((aEvent) => testPollOff(aEvent.command, data.expect)));
// Wait icc-stkcommand system message.
promises.push(waitForSystemMessage("icc-stkcommand")
.then((aMessage) => {
is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
testPollOff(aMessage.command, data.expect);
}));
// Send emulator command to generate stk unsolicited event.
promises.push(sendEmulatorStkPdu(data.command));
return Promise.all(promises);
});
}
return promise;
});

Просмотреть файл

@ -5,11 +5,14 @@ MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "d009810301040082028182",
{command: "D009" + // Length
"8103010400" + // Command details
"82028182", // Device identities
expect: {commandQualifier: 0x00}}
];
function testPollOff(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_POLL_OFF, "typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
}
@ -21,12 +24,18 @@ startTestCommon(function() {
for (let i = 0; i < TEST_DATA.length; i++) {
let data = TEST_DATA[i];
promise = promise.then(() => {
log("pull_off_cmd: " + data.command);
log("poll_off_cmd: " + data.command);
let promises = [];
// Wait onstkcommand event.
promises.push(waitForTargetEvent(icc, "stkcommand")
.then((aEvent) => testPollOff(aEvent.command, data.expect)));
// Wait icc-stkcommand system message.
promises.push(waitForSystemMessage("icc-stkcommand")
.then((aMessage) => {
is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
testPollOff(aMessage.command, data.expect);
}));
// Send emulator command to generate stk unsolicited event.
promises.push(sendEmulatorStkPdu(data.command));

Просмотреть файл

@ -5,13 +5,19 @@ MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "d0108103010101820281829205013f002fe2",
{command: "D010" + // Length
"8103010101" + // Command details
"82028182" + // Device identities
"9205013F002FE2", // File list
expect: {commandQualifier: 0x01}},
{command: "d009810301010482028182",
{command: "D009" + // Length
"8103010104" + // Command details
"82028182", // Device identities
expect: {commandQualifier: 0x04}}
];
function testRefresh(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_REFRESH, "typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
}
@ -29,6 +35,12 @@ startTestCommon(function() {
// Wait onstkcommand event.
promises.push(waitForTargetEvent(icc, "stkcommand")
.then((aEvent) => testRefresh(aEvent.command, data.expect)));
// Wait icc-stkcommand system message.
promises.push(waitForSystemMessage("icc-stkcommand")
.then((aMessage) => {
is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
testRefresh(aMessage.command, data.expect);
}));
// Send emulator command to generate stk unsolicited event.
promises.push(sendEmulatorStkPdu(data.command));

Просмотреть файл

@ -5,44 +5,160 @@ MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "d03d810301240082028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d20338f07044974656d2034",
{command: "D03D" + // Length
"8103012400" + // Command details
"82028182" + // Device identities
"850E546F6F6C6B69742053656C656374" + // Alpha identifier
"8F07014974656D2031" + // Item
"8F07024974656D2032" + // Item
"8F07034974656D2033" + // Item
"8F07044974656D2034", // Item
expect: {commandQualifier: 0x00,
title: "Toolkit Select",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}, {identifier: 4, text: "Item 4"}]}},
{command: "d081fc810301240082028182850a4c617267654d656e75318f05505a65726f8f044f4f6e658f044e54776f8f064d54687265658f054c466f75728f054b466976658f044a5369788f0649536576656e8f064845696768748f05474e696e658f0646416c7068618f0645427261766f8f0844436861726c69658f064344656c74618f05424563686f8f0941466f782d74726f748f0640426c61636b8f063f42726f776e8f043e5265648f073d4f72616e67658f073c59656c6c6f778f063b477265656e8f053a426c75658f073956696f6c65748f0538477265798f063757686974658f06366d696c6c698f06356d6963726f8f05346e616e6f8f05337069636f",
items: [{identifier: 1, text: "Item 1"},
{identifier: 2, text: "Item 2"},
{identifier: 3, text: "Item 3"},
{identifier: 4, text: "Item 4"}]}},
{command: "D081FC" + // Length
"8103012400" + // Command details
"82028182" + // Device identities
"850A4C617267654D656E7531" + // Alpha identifier
"8F05505A65726F" + // Item
"8F044F4F6E65" + // Item
"8F044E54776F" + // Item
"8F064D5468726565" + // Item
"8F054C466F7572" + // Item
"8F054B46697665" + // Item
"8F044A536978" + // Item
"8F0649536576656E" + // Item
"8F06484569676874" + // Item
"8F05474E696E65" + // Item
"8F0646416C706861" + // Item
"8F0645427261766F" + // Item
"8F0844436861726C6965" + // Item
"8F064344656C7461" + // Item
"8F05424563686F" + // Item
"8F0941466F782D74726F74" + // Item
"8F0640426C61636B" + // Item
"8F063F42726F776E" + // Item
"8F043E526564" + // Item
"8F073D4F72616E6765" + // Item
"8F073C59656C6C6F77" + // Item
"8F063B477265656E" + // Item
"8F053A426C7565" + // Item
"8F073956696F6C6574" + // Item
"8F053847726579" + // Item
"8F06375768697465" + // Item
"8F06366D696C6C69" + // Item
"8F06356D6963726F" + // Item
"8F05346E616E6F" + // Item
"8F05337069636F", // Item
expect: {commandQualifier: 0x00,
title: "LargeMenu1",
items: [{identifier: 80, text: "Zero"}, {identifier: 79, text: "One"}, {identifier: 78, text: "Two"}, {identifier: 77, text: "Three"}, {identifier: 76, text: "Four"}, {identifier: 75, text: "Five"}, {identifier: 74, text: "Six"}, {identifier: 73, text: "Seven"}, {identifier: 72, text: "Eight"}, {identifier: 71, text: "Nine"}, {identifier: 70, text: "Alpha"}, {identifier: 69, text: "Bravo"}, {identifier: 68, text: "Charlie"}, {identifier: 67, text: "Delta"}, {identifier: 66, text: "Echo"}, {identifier: 65, text: "Fox-trot"}, {identifier: 64, text: "Black"}, {identifier: 63, text: "Brown"}, {identifier: 62, text: "Red"}, {identifier: 61, text: "Orange"}, {identifier: 60, text: "Yellow"}, {identifier: 59, text: "Green"}, {identifier: 58, text: "Blue"}, {identifier: 57, text: "Violet"}, {identifier: 56, text: "Grey"}, {identifier: 55, text: "White"}, {identifier: 54, text: "milli"}, {identifier: 53, text: "micro"}, {identifier: 52, text: "nano"}, {identifier: 51, text: "pico"}]}},
{command: "d081fb810301240082028182850a4c617267654d656e75328f1eff43616c6c20466f7277617264696e6720556e636f6e646974696f6e616c8f1dfe43616c6c20466f7277617264696e67204f6e205573657220427573798f1cfd43616c6c20466f7277617264696e67204f6e204e6f205265706c798f26fc43616c6c20466f7277617264696e67204f6e2055736572204e6f7420526561636861626c658f1efb42617272696e67204f6620416c6c204f7574676f696e672043616c6c738f2cfa42617272696e67204f6620416c6c204f7574676f696e6720496e7465726e6174696f6e616c2043616c6c738f11f9434c492050726573656e746174696f6e",
items: [{identifier: 80, text: "Zero"},
{identifier: 79, text: "One"},
{identifier: 78, text: "Two"},
{identifier: 77, text: "Three"},
{identifier: 76, text: "Four"},
{identifier: 75, text: "Five"},
{identifier: 74, text: "Six"},
{identifier: 73, text: "Seven"},
{identifier: 72, text: "Eight"},
{identifier: 71, text: "Nine"},
{identifier: 70, text: "Alpha"},
{identifier: 69, text: "Bravo"},
{identifier: 68, text: "Charlie"},
{identifier: 67, text: "Delta"},
{identifier: 66, text: "Echo"},
{identifier: 65, text: "Fox-trot"},
{identifier: 64, text: "Black"},
{identifier: 63, text: "Brown"},
{identifier: 62, text: "Red"},
{identifier: 61, text: "Orange"},
{identifier: 60, text: "Yellow"},
{identifier: 59, text: "Green"},
{identifier: 58, text: "Blue"},
{identifier: 57, text: "Violet"},
{identifier: 56, text: "Grey"},
{identifier: 55, text: "White"},
{identifier: 54, text: "milli"},
{identifier: 53, text: "micro"},
{identifier: 52, text: "nano"},
{identifier: 51, text: "pico"}]}},
{command: "D081FB" + // Length
"8103012400" + // Command details
"82028182" + // Device identities
"850A4C617267654D656E7532" + // Alpha identifier
"8F1EFF43616C6C20466F7277617264696E6720556E636F6E6469" + // Item
"74696F6E616C" +
"8F1DFE43616C6C20466F7277617264696E67204F6E2055736572" + // Item
"2042757379" +
"8F1CFD43616C6C20466F7277617264696E67204F6E204E6F2052" + // Item
"65706C79" +
"8F26FC43616C6C20466F7277617264696E67204F6E2055736572" + // Item
"204E6F7420526561636861626C65" +
"8F1EFB42617272696E67204F6620416C6C204F7574676F696E67" + // Item
"2043616C6C73" +
"8F2CFA42617272696E67204F6620416C6C204F7574676F696E67" + // Item
"20496E7465726E6174696F6E616C2043616C6C73" +
"8F11F9434C492050726573656E746174696F6E", // Item
expect: {commandQualifier: 0x00,
title: "LargeMenu2",
items: [{identifier: 255, text: "Call Forwarding Unconditional"}, {identifier: 254, text: "Call Forwarding On User Busy"}, {identifier: 253, text: "Call Forwarding On No Reply"}, {identifier: 252, text: "Call Forwarding On User Not Reachable"}, {identifier: 251, text: "Barring Of All Outgoing Calls"}, {identifier: 250, text: "Barring Of All Outgoing International Calls"}, {identifier: 249, text: "CLI Presentation"}]}},
{command: "d022810301240082028182850b53656c656374204974656d8f04114f6e658f041254776f",
items: [{identifier: 255, text: "Call Forwarding Unconditional"},
{identifier: 254, text: "Call Forwarding On User Busy"},
{identifier: 253, text: "Call Forwarding On No Reply"},
{identifier: 252, text: "Call Forwarding On User Not Reachable"},
{identifier: 251, text: "Barring Of All Outgoing Calls"},
{identifier: 250, text: "Barring Of All Outgoing International Calls"},
{identifier: 249, text: "CLI Presentation"}]}},
{command: "D081FD" + // Length
"8103012400" + // Command details
"82028182" + // Device identities
"8581ED5468652053494D207368616C6C20737570" + // Alpha identifier
"706C79206120736574206F66206974656D732066" +
"726F6D207768696368207468652075736572206D" +
"61792063686F6F7365206F6E652E204561636820" +
"6974656D20636F6D70726973657320612073686F" +
"7274206964656E74696669657220287573656420" +
"746F20696E646963617465207468652073656C65" +
"6374696F6E2920616E6420612074657874207374" +
"72696E672E204F7074696F6E616C6C7920746865" +
"2053494D206D617920696E636C75646520616E20" +
"616C706861206964656E7469666965722E205468" +
"6520616C706861206964656E7469666965722069" +
"8F020159", // Item
expect: {commandQualifier: 0x00,
title: "Select Item",
items: [{identifier: 17, text: "One"}, {identifier: 18, text: "Two"}]}},
{command: "d081fd8103012400820281828581ed5468652053494d207368616c6c20737570706c79206120736574206f66206974656d732066726f6d207768696368207468652075736572206d61792063686f6f7365206f6e652e2045616368206974656d20636f6d70726973657320612073686f7274206964656e74696669657220287573656420746f20696e646963617465207468652073656c656374696f6e2920616e642061207465787420737472696e672e204f7074696f6e616c6c79207468652053494d206d617920696e636c75646520616e20616c706861206964656e7469666965722e2054686520616c706861206964656e74696669657220698f020159",
expect: {commandQualifier: 0x00,
title: "The SIM shall supply a set of items from which the user may choose one. Each item comprises a short identifier (used to indicate the selection) and a text string. Optionally the SIM may include an alpha identifier. The alpha identifier i",
title: "The SIM shall supply a set of items from which the user " +
"may choose one. Each item comprises a short identifier " +
"(used to indicate the selection) and a text string. " +
"Optionally the SIM may include an alpha identifier. " +
"The alpha identifier i",
items: [{identifier: 1, text: "Y"}]}},
{command: "d081f3810301240082028182850a304c617267654d656e758f1dff312043616c6c20466f727761726420556e636f6e646974696f6e616c8f1cfe322043616c6c20466f7277617264204f6e205573657220427573798f1bfd332043616c6c20466f7277617264204f6e204e6f205265706c798f25fc342043616c6c20466f7277617264204f6e2055736572204e6f7420526561636861626c658f20fb352042617272696e67204f6620416c6c204f7574676f696e672043616c6c738f24fa362042617272696e67204f6620416c6c204f7574676f696e6720496e742043616c6c738f13f93720434c492050726573656e746174696f6e",
expect: {commandQualifier: 0x00,
title: "0LargeMenu",
items: [{identifier: 255, text: "1 Call Forward Unconditional"}, {identifier: 254, text: "2 Call Forward On User Busy"}, {identifier: 253, text: "3 Call Forward On No Reply"}, {identifier: 252, text: "4 Call Forward On User Not Reachable"}, {identifier: 251, text: "5 Barring Of All Outgoing Calls"}, {identifier: 250, text: "6 Barring Of All Outgoing Int Calls"}, {identifier: 249, text: "7 CLI Presentation"}]}},
{command: "d039810301240082028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d20331803131026",
{command: "D039" + // Length
"8103012400" + // Command details
"82028182" + // Device identities
"850E546F6F6C6B69742053656C656374" + // Alpha identifier
"8F07014974656D2031" + // Item
"8F07024974656D2032" + // Item
"8F07034974656D2033" + // Item
"1803131026", // Items next action indicator
expect: {commandQualifier: 0x00,
title: "Toolkit Select",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}],
nextActionList: [MozIccManager.STK_CMD_SEND_SMS, MozIccManager.STK_CMD_SET_UP_CALL, MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO]}},
{command: "d037810301240082028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d2033900102",
expect: {commandQualifier: 0x00,
title: "Toolkit Select",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
{command: "d034810301248082028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d2033",
expect: {commandQualifier: 0x80,
title: "Toolkit Select",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
{command: "d03e810301240082028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d20339e0201019f0401030303",
items: [{identifier: 1, text: "Item 1"},
{identifier: 2, text: "Item 2"},
{identifier: 3, text: "Item 3"}],
nextActionList: [MozIccManager.STK_CMD_SEND_SMS,
MozIccManager.STK_CMD_SET_UP_CALL,
MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO]}},
{command: "D03E" + // Length
"8103012400" + // Command details
"82028182" + // Device identities
"850E546F6F6C6B69742053656C656374" + // Alpha identifier
"8F07014974656D2031" + // Item
"8F07024974656D2032" + // Item
"8F07034974656D2033" + // Item
"9E020101" + // Icon identifier
"9F0401030303", // Item icon identifier list
expect: {commandQualifier: 0x00,
title: "Toolkit Select",
iconSelfExplanatory: false,
@ -50,174 +166,121 @@ const TEST_DATA = [
items: [{identifier: 1, text: "Item 1", iconSelfExplanatory: false, icons: [COLOR_ICON]},
{identifier: 2, text: "Item 2", iconSelfExplanatory: false, icons: [COLOR_ICON]},
{identifier: 3, text: "Item 3", iconSelfExplanatory: false, icons: [COLOR_ICON]}]}},
{command: "d03e810301240082028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d20339e0200019f0400050505",
{command: "D028" + // Length
"8103012400" + // Command details
"82028182" + // Device identities
"850E546F6F6C6B69742053656C656374" + // Alpha identifier
"8F0101" + // Item
"8F0102" + // Item
"8F0103" + // Item
"9F0400050505", // Item icon identifier list
expect: {commandQualifier: 0x00,
title: "Toolkit Select",
iconSelfExplanatory: true,
icons: [BASIC_ICON],
items: [{identifier: 1, text: "Item 1", iconSelfExplanatory: true, icons: [COLOR_TRANSPARENCY_ICON]},
{identifier: 2, text: "Item 2", iconSelfExplanatory: true, icons: [COLOR_TRANSPARENCY_ICON]},
{identifier: 3, text: "Item 3", iconSelfExplanatory: true, icons: [COLOR_TRANSPARENCY_ICON]}]}},
{command: "d034810301240382028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d2033",
expect: {commandQualifier: 0x03,
items: [{identifier: 1, text: "", iconSelfExplanatory: true, icons: [COLOR_TRANSPARENCY_ICON]},
{identifier: 2, text: "", iconSelfExplanatory: true, icons: [COLOR_TRANSPARENCY_ICON]},
{identifier: 3, text: "", iconSelfExplanatory: true, icons: [COLOR_TRANSPARENCY_ICON]}]}},
{command: "D034" + // Length
"8103012483" + // Command details
"82028182" + // Device identities
"850E546F6F6C6B69742053656C656374" + // Alpha identifier
"8F07014974656D2031" + // Item
"8F07024974656D2032" + // Item
"8F07034974656D2033", // Item
expect: {commandQualifier: 0x83,
title: "Toolkit Select",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
{command: "d034810301240182028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d2033",
expect: {commandQualifier: 0x01,
title: "Toolkit Select",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
{command: "d02b810301240482028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d2032",
expect: {commandQualifier: 0x04,
title: "Toolkit Select",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
{command: "d030810301240082028182850a3c54494d452d4f55543e8f07014974656d20318f07024974656d20328f07034974656d2033",
expect: {commandQualifier: 0x00,
title: "<TIME-OUT>",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420318f07014974656d20318f07024974656d2032d004001000b4d108000600b4000600b4",
items: [{identifier: 1, text: "Item 1"},
{identifier: 2, text: "Item 2"},
{identifier: 3, text: "Item 3"}]}},
{command: "D03D" + // Length
"8103012400" + // Command details
"82028182" + // Device identities
"8510546F6F6C6B69742053656C6563742031" + // Alpha identifier
"8F07014974656D2031" + // Item
"8F07024974656D2032" + // Item
"D004001000B4" + // Text attribute
"D108000600B4000600B4", // Item text attribute list
expect: {commandQualifier: 0x00,
title: "Toolkit Select 1",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
{command: "d02d8103012400820281828510546f6f6c6b69742053656c65637420328f07014974656d20338f07024974656d2034",
expect: {commandQualifier: 0x00,
title: "Toolkit Select 2",
items: [{identifier: 1, text: "Item 3"}, {identifier: 2, text: "Item 4"}]}},
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420318f07014974656d20318f07024974656d2032d004001001b4d108000601b4000601b4",
expect: {commandQualifier: 0x00,
title: "Toolkit Select 1",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
{command: "d02d8103012400820281828510546f6f6c6b69742053656c65637420328f07014974656d20338f07024974656d2034",
expect: {commandQualifier: 0x00,
title: "Toolkit Select 2",
items: [{identifier: 1, text: "Item 3"}, {identifier: 2, text: "Item 4"}]}},
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420318f07014974656d20318f07024974656d2032d004001002b4d108000602b4000602b4",
expect: {commandQualifier: 0x00,
title: "Toolkit Select 1",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
{command: "d02d8103012400820281828510546f6f6c6b69742053656c65637420328f07014974656d20338f07024974656d2034",
expect: {commandQualifier: 0x00,
title: "Toolkit Select 2",
items: [{identifier: 1, text: "Item 3"}, {identifier: 2, text: "Item 4"}]}},
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420318f07014974656d20318f07024974656d2032d004001004b4d108000604b4000604b4",
expect: {commandQualifier: 0x00,
title: "Toolkit Select 1",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420328f07014974656d20338f07024974656d2034d004001000b4d108000600b4000600b4",
expect: {commandQualifier: 0x00,
title: "Toolkit Select 2",
items: [{identifier: 1, text: "Item 3"}, {identifier: 2, text: "Item 4"}]}},
{command: "d02d8103012400820281828510546f6f6c6b69742053656c65637420338f07014974656d20358f07024974656d2036",
expect: {commandQualifier: 0x00,
title: "Toolkit Select 3",
items: [{identifier: 1, text: "Item 5"}, {identifier: 2, text: "Item 6"}]}},
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420318f07014974656d20318f07024974656d2032d004001008b4d108000608b4000608b4",
expect: {commandQualifier: 0x00,
title: "Toolkit Select 1",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420328f07014974656d20338f07024974656d2034d004001000b4d108000600b4000600b4",
expect: {commandQualifier: 0x00,
title: "Toolkit Select 2",
items: [{identifier: 1, text: "Item 3"}, {identifier: 2, text: "Item 4"}]}},
{command: "d02d8103012400820281828510546f6f6c6b69742053656c65637420338f07014974656d20358f07024974656d2036",
expect: {commandQualifier: 0x00,
title: "Toolkit Select 3",
items: [{identifier: 1, text: "Item 5"}, {identifier: 2, text: "Item 6"}]}},
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420318f07014974656d20318f07024974656d2032d004001010b4d108000610b4000610b4",
expect: {commandQualifier: 0x00,
title: "Toolkit Select 1",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420328f07014974656d20338f07024974656d2034d004001000b4d108000600b4000600b4",
expect: {commandQualifier: 0x00,
title: "Toolkit Select 2",
items: [{identifier: 1, text: "Item 3"}, {identifier: 2, text: "Item 4"}]}},
{command: "d02d8103012400820281828510546f6f6c6b69742053656c65637420338f07014974656d20358f07024974656d2036",
expect: {commandQualifier: 0x00,
title: "Toolkit Select 3",
items: [{identifier: 1, text: "Item 5"}, {identifier: 2, text: "Item 6"}]}},
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420318f07014974656d20318f07024974656d2032d004001020b4d108000620b4000620b4",
expect: {commandQualifier: 0x00,
title: "Toolkit Select 1",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420328f07014974656d20338f07024974656d2034d004001000b4d108000600b4000600b4",
expect: {commandQualifier: 0x00,
title: "Toolkit Select 2",
items: [{identifier: 1, text: "Item 3"}, {identifier: 2, text: "Item 4"}]}},
{command: "d02d8103012400820281828510546f6f6c6b69742053656c65637420338f07014974656d20358f07024974656d2036",
expect: {commandQualifier: 0x00,
title: "Toolkit Select 3",
items: [{identifier: 1, text: "Item 5"}, {identifier: 2, text: "Item 6"}]}},
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420318f07014974656d20318f07024974656d2032d004001040b4d108000640b4000640b4",
expect: {commandQualifier: 0x00,
title: "Toolkit Select 1",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420328f07014974656d20338f07024974656d2034d004001000b4d108000600b4000600b4",
expect: {commandQualifier: 0x00,
title: "Toolkit Select 2",
items: [{identifier: 1, text: "Item 3"}, {identifier: 2, text: "Item 4"}]}},
{command: "d02d8103012400820281828510546f6f6c6b69742053656c65637420338f07014974656d20358f07024974656d2036",
expect: {commandQualifier: 0x00,
title: "Toolkit Select 3",
items: [{identifier: 1, text: "Item 5"}, {identifier: 2, text: "Item 6"}]}},
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420318f07014974656d20318f07024974656d2032d004001080b4d108000680b4000680b4",
expect: {commandQualifier: 0x00,
title: "Toolkit Select 1",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420328f07014974656d20338f07024974656d2034d004001000b4d108000600b4000600b4",
expect: {commandQualifier: 0x00,
title: "Toolkit Select 2",
items: [{identifier: 1, text: "Item 3"}, {identifier: 2, text: "Item 4"}]}},
{command: "d02d8103012400820281828510546f6f6c6b69742053656c65637420338f07014974656d20358f07024974656d2036",
expect: {commandQualifier: 0x00,
title: "Toolkit Select 3",
items: [{identifier: 1, text: "Item 5"}, {identifier: 2, text: "Item 6"}]}},
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420318f07014974656d20318f07024974656d2032d004001000b4d108000600b4000600b4",
expect: {commandQualifier: 0x00,
title: "Toolkit Select 1",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
{command: "d02d8103012400820281828510546f6f6c6b69742053656c65637420328f07014974656d20338f07024974656d2034",
expect: {commandQualifier: 0x00,
title: "Toolkit Select 2",
items: [{identifier: 1, text: "Item 3"}, {identifier: 2, text: "Item 4"}]}},
{command: "d07e8103012400820281828519800417041404200410041204210422041204230419042204158f1c018004170414042004100412042104220412042304190422041500318f1c028004170414042004100412042104220412042304190422041500328f1c03800417041404200410041204210422041204230419042204150033",
items: [{identifier: 1, text: "Item 1"},
{identifier: 2, text: "Item 2"}]}},
{command: "D069" + // Length
"8103012400" + // Command details
"82028182" + // Device identities
"851980041704140420041004120421042204120423041904220415" + // Alpha identifier
"8F1C01800417041404200410041204210422041204230419042204150031" + // Item
"8F1102810D089794A09092A1A292A399A29532" + // Item
"8F1203820D041087849080829192829389928533", // Item
expect: {commandQualifier: 0x00,
title: "ЗДРАВСТВУЙТЕ",
items: [{identifier: 1, text: "ЗДРАВСТВУЙТЕ1"}, {identifier: 2, text: "ЗДРАВСТВУЙТЕ2"}, {identifier: 3, text: "ЗДРАВСТВУЙТЕ3"}]}},
{command: "d053810301240082028182850f810c089794a09092a1a292a399a2958f1101810d089794a09092a1a292a399a295318f1102810d089794a09092a1a292a399a295328f1103810d089794a09092a1a292a399a29533",
expect: {commandQualifier: 0x00,
title: "ЗДРАВСТВУЙТЕ",
items: [{identifier: 1, text: "ЗДРАВСТВУЙТЕ1"}, {identifier: 2, text: "ЗДРАВСТВУЙТЕ2"}, {identifier: 3, text: "ЗДРАВСТВУЙТЕ3"}]}},
{command: "d0578103012400820281828510820c04108784908082919282938992858f1201820d0410878490808291928293899285318f1202820d0410878490808291928293899285328f1203820d041087849080829192829389928533",
expect: {commandQualifier: 0x00,
title: "ЗДРАВСТВУЙТЕ",
items: [{identifier: 1, text: "ЗДРАВСТВУЙТЕ1"}, {identifier: 2, text: "ЗДРАВСТВУЙТЕ2"}, {identifier: 3, text: "ЗДРАВСТВУЙТЕ3"}]}},
{command: "d03e810301240082028182850b805de551777bb1900962e98f080180987976ee4e008f080280987976ee4e8c8f080380987976ee4e098f080480987976ee56db",
expect: {commandQualifier: 0x00,
title: "工具箱选择",
items: [{identifier: 1, text: "项目一"}, {identifier: 2, text: "项目二"}, {identifier: 3, text: "项目三"}, {identifier: 4, text: "项目四"}]}},
{command: "d0388103012400820281828509800038003030eb00308f0a01800038003030eb00318f0a02800038003030eb00328f0a03800038003030eb0033",
items: [{identifier: 1, text: "ЗДРАВСТВУЙТЕ1"},
{identifier: 2, text: "ЗДРАВСТВУЙТЕ2"},
{identifier: 3, text: "ЗДРАВСТВУЙТЕ3"}]}},
{command: "D038" + // Length
"8103012400" + // Command details
"82028182" + // Device identities
"8509800038003030EB0030" + // Alpha identifier
"8F0A01800038003030EB0031" + // Item
"8F0A02800038003030EB0032" + // Item
"8F0A03800038003030EB0033", // Item
expect: {commandQualifier: 0x00,
title: "80ル0",
items: [{identifier: 1, text: "80ル1"}, {identifier: 2, text: "80ル2"}, {identifier: 3, text: "80ル3"}]}},
{command: "d03081030124008202818285078104613831eb308f08018104613831eb318f08028104613831eb328f08038104613831eb33",
items: [{identifier: 1, text: "80ル1"},
{identifier: 2, text: "80ル2"},
{identifier: 3, text: "80ル3"}]}},
{command: "D030" + // Length
"8103012400" + // Command details
"82028182" + // Device identities
"85078104613831EB30" + // Alpha identifier
"8F08018104613831EB31" + // Item
"8F08028104613831EB32" + // Item
"8F08038104613831EB33", // Item
expect: {commandQualifier: 0x00,
title: "81ル0",
items: [{identifier: 1, text: "81ル1"}, {identifier: 2, text: "81ル2"}, {identifier: 3, text: "81ル3"}]}},
{command: "d0348103012400820281828508820430a03832cb308f0901820430a03832cb318f0902820430a03832cb328f0903820430a03832cb33",
items: [{identifier: 1, text: "81ル1"},
{identifier: 2, text: "81ル2"},
{identifier: 3, text: "81ル3"}]}},
{command: "D034" + // Length
"8103012400" + // Command details
"82028182" + // Device identities
"8508820430A03832CB30" + // Alpha identifier
"8F0901820430A03832CB31" + // Item
"8F0902820430A03832CB32" + // Item
"8F0903820430A03832CB33", // Item
expect: {commandQualifier: 0x00,
title: "82ル0",
items: [{identifier: 1, text: "82ル1"}, {identifier: 2, text: "82ル2"}, {identifier: 3, text: "82ル3"}]}},
{command: "d039810301240082028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d20331803000081",
items: [{identifier: 1, text: "82ル1"},
{identifier: 2, text: "82ル2"},
{identifier: 3, text: "82ル3"}]}},
{command: "D03C" + // Length
"8103012400" + // Command details
"82028182" + // Device identities
"850E546F6F6C6B69742053656C656374" + // Alpha identifier
"8F07014974656D2031" + // Item
"8F07024974656D2032" + // Item
"8F07034974656D2033" + // Item
"1803000081" + // Items next action indicator
"100102", // Item identifier
expect: {commandQualifier: 0x00,
title: "Toolkit Select",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}],
nextActionList: [MozIccManager.STK_NEXT_ACTION_NULL, MozIccManager.STK_NEXT_ACTION_NULL, MozIccManager.STK_NEXT_ACTION_END_PROACTIVE_SESSION]}},
items: [{identifier: 1, text: "Item 1"},
{identifier: 2, text: "Item 2"},
{identifier: 3, text: "Item 3"}],
nextActionList: [MozIccManager.STK_NEXT_ACTION_NULL,
MozIccManager.STK_NEXT_ACTION_NULL,
MozIccManager.STK_NEXT_ACTION_END_PROACTIVE_SESSION],
defaultItem: 1}},
];
function testSelectItem(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SELECT_ITEM, "typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
is(aCommand.options.presentationType, aCommand.commandQualifier & 0x03,
"presentationType");
is(aCommand.options.isHelpAvailable, !!(aCommand.commandQualifier & 0x80),
"isHelpAvailable");
is(aCommand.options.title, aExpect.title, "options.title");
is(aCommand.options.presentationType, aCommand.commandQualifier & 0x03, "presentationType");
for (let index in aExpect.items) {
let item = aCommand.options.items[index];
@ -234,18 +297,25 @@ function testSelectItem(aCommand, aExpect) {
}
}
if (aExpect.icons) {
// icons is optional.
if ("icons" in aExpect) {
isIcons(aCommand.options.icons, aExpect.icons);
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
"options.iconSelfExplanatory");
}
if (aExpect.nextActionList) {
// nextActionList is optional.
if ("nextActionList" in aExpect) {
for (let index in aExpect.nextActionList) {
is(aCommand.options.nextActionList[index], aExpect.nextActionList[index],
"options.nextActionList[" + index + "]");
}
}
// defaultItem is optional.
if ("defaultItem" in aExpect) {
is(aCommand.options.defaultItem, aExpect.defaultItem, "options.defaultItem");
}
}
// Start tests
@ -261,6 +331,12 @@ startTestCommon(function() {
// Wait onstkcommand event.
promises.push(waitForTargetEvent(icc, "stkcommand")
.then((aEvent) => testSelectItem(aEvent.command, data.expect)));
// Wait icc-stkcommand system message.
promises.push(waitForSystemMessage("icc-stkcommand")
.then((aMessage) => {
is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
testSelectItem(aMessage.command, data.expect);
}));
// Send emulator command to generate stk unsolicited event.
promises.push(sendEmulatorStkPdu(data.command));

Просмотреть файл

@ -5,110 +5,79 @@ MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "d01b810301140082028183850953656e642044544d46ac052143658709",
{command: "D01B" + // Length
"8103011400" + // Command details
"82028183" + // Device identities
"850953656E642044544D46" + // Alpha identifier
"AC052143658709", // DTMF string
expect: {commandQualifier: 0x00,
text: "Send DTMF"}},
{command: "d010810301140082028183ac052143658709",
{command: "D010" + // Length
"8103011400" + // Command details
"82028183" + // Device identities
"AC052143658709", // DTMF string
expect: {commandQualifier: 0x00}},
{command: "d0138103011400820281838500ac06c1cccccccc2c",
{command: "D013" + // Length
"8103011400" + // Command details
"82028183" + // Device identities
"8500" + // Alpha identifier
"AC06C1CCCCCCCC2C", // DTMF string
expect: {commandQualifier: 0x00,
text: ""}},
{command: "d011810301140082028183ac06c1cccccccc2c",
expect: {commandQualifier: 0x00}},
{command: "d01d810301140082028183850a42617369632049636f6eac02c1f29e020001",
{command: "D01D" + // Length
"8103011400" + // Command details
"82028183" + // Device identities
"850A42617369632049636F6E" + // Alpha identifier
"AC02C1F2" + // DTMF string
"9E020001", // Icon identifier
expect: {commandQualifier: 0x00,
text: "Basic Icon",
iconSelfExplanatory: true,
icons: [BASIC_ICON]}},
{command: "d011810301140082028183ac02c1f29e020005",
{command: "D011" + // Length
"8103011400" + // Command details
"82028183" + // Device identities
"AC02C1F2" + // DTMF string
"9E020005", // Icon identifier
expect: {commandQualifier: 0x00,
iconSelfExplanatory: true,
icons: [COLOR_TRANSPARENCY_ICON]}},
{command: "d01c810301140082028183850953656e642044544d46ac02c1f29e020101",
expect: {commandQualifier: 0x00,
text: "Send DTMF",
iconSelfExplanatory: false,
icons: [BASIC_ICON]}},
{command: "d011810301140082028183ac02c1f29e020105",
expect: {commandQualifier: 0x00,
iconSelfExplanatory: false,
icons: [COLOR_TRANSPARENCY_ICON]}},
{command: "d028810301140082028183851980041704140420041004120421042204120423041904220415ac02c1f2",
{command: "D028" + // Length
"8103011400" + // Command details
"82028183" + // Device identities
"851980041704140420041004120421042204120423041904220415" + // Alpha identifier
"AC02C1F2", // DTMF string
expect: {commandQualifier: 0x00,
text: "ЗДРАВСТВУЙТЕ"}},
{command: "d00d810301140082028183ac02c1f2",
expect: {commandQualifier: 0x00}},
{command: "d023810301140082028183850b53656e642044544d462031ac052143658709d004000b00b4",
{command: "D023" + // Length
"8103011400" + // Command details
"82028183" + // Device identities
"850B53656E642044544D462031" + // Alpha identifier
"AC052143658709" + // DTMF string
"D004000B00B4", // Text attribute
expect: {commandQualifier: 0x00,
text: "Send DTMF 1"}},
{command: "d016810301140082028183ac052143658709d004000b00b4",
expect: {commandQualifier: 0x00}},
{command: "d01d810301140082028183850b53656e642044544d462032ac052143658709",
expect: {commandQualifier: 0x00,
text: "Send DTMF 2"}},
{command: "d023810301140082028183850b53656e642044544d462031ac052143658709d004000b01b4",
expect: {commandQualifier: 0x00,
text: "Send DTMF 1"}},
{command: "d016810301140082028183ac052143658709d004000b01b4",
expect: {commandQualifier: 0x00}},
{command: "d023810301140082028183850b53656e642044544d462031ac052143658709d00400b002b4",
expect: {commandQualifier: 0x00,
text: "Send DTMF 1"}},
{command: "d016810301140082028183ac052143658709d00400b002b4",
expect: {commandQualifier: 0x00}},
{command: "d023810301140082028183850b53656e642044544d462031ac052143658709d004000b04b4",
expect: {commandQualifier: 0x00,
text: "Send DTMF 1"}},
{command: "d016810301140082028183ac052143658709d004000b04b4",
expect: {commandQualifier: 0x00}},
{command: "d023810301140082028183850b53656e642044544d462032ac052143658709d004000b00b4",
expect: {commandQualifier: 0x00,
text: "Send DTMF 2"}},
{command: "d01d810301140082028183850b53656e642044544d462033ac052143658709",
expect: {commandQualifier: 0x00,
text: "Send DTMF 3"}},
{command: "d023810301140082028183850b53656e642044544d462031ac052143658709d004000b08b4",
expect: {commandQualifier: 0x00,
text: "Send DTMF 1"}},
{command: "d016810301140082028183ac052143658709d004000b08b4",
expect: {commandQualifier: 0x00}},
{command: "d023810301140082028183850b53656e642044544d462031ac052143658709d004000b10b4",
expect: {commandQualifier: 0x00,
text: "Send DTMF 1"}},
{command: "d016810301140082028183ac052143658709d004000b10b4",
expect: {commandQualifier: 0x00}},
{command: "d023810301140082028183850b53656e642044544d462031ac052143658709d004000b20b4",
expect: {commandQualifier: 0x00,
text: "Send DTMF 1"}},
{command: "d016810301140082028183ac052143658709d004000b20b4",
expect: {commandQualifier: 0x00}},
{command: "d023810301140082028183850b53656e642044544d462031ac052143658709d004000b40b4",
expect: {commandQualifier: 0x00,
text: "Send DTMF 1"}},
{command: "d016810301140082028183ac052143658709d004000b40b4",
expect: {commandQualifier: 0x00}},
{command: "d023810301140082028183850b53656e642044544d462031ac052143658709d004000b80b4",
expect: {commandQualifier: 0x00,
text: "Send DTMF 1"}},
{command: "d016810301140082028183ac052143658709d004000b80b4",
expect: {commandQualifier: 0x00}},
{command: "d0148103011400820281838505804f60597dac02c1f2",
{command: "D014" + // Length
"8103011400" + // Command details
"82028183" + // Device identities
"8505804F60597D" + // Alpha identifier
"AC02C1F2", // DTMF string
expect: {commandQualifier: 0x00,
text: "你好"}},
{command: "d01281030114008202818385038030ebac02c1f2",
expect: {commandQualifier: 0x00,
text: "ル"}}
];
function testSendDTMF(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SEND_DTMF, "typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
if (aExpect.text) {
// text is optional.
if ("text" in aExpect) {
is(aCommand.options.text, aExpect.text, "options.text");
}
if (aExpect.icons) {
// icons is optional.
if ("icons" in aExpect) {
isIcons(aCommand.options.icons, aExpect.icons);
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
"options.iconSelfExplanatory");
@ -128,6 +97,12 @@ startTestCommon(function() {
// Wait onstkcommand event.
promises.push(waitForTargetEvent(icc, "stkcommand")
.then((aEvent) => testSendDTMF(aEvent.command, data.expect)));
// Wait icc-stkcommand system message.
promises.push(waitForSystemMessage("icc-stkcommand")
.then((aMessage) => {
is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
testSendDTMF(aMessage.command, data.expect);
}));
// Send emulator command to generate stk unsolicited event.
promises.push(sendEmulatorStkPdu(data.command));

Просмотреть файл

@ -5,157 +5,173 @@ MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "d037810301130082028183850753656e6420534d86099111223344556677f88b180100099110325476f840f40c54657374204d657373616765",
expect: {commandQualifier: 0x00,
text: "Send SM"}},
{command: "d02e81030113008202818386099111223344556677f88b180100099110325476f840f40c54657374204d657373616765",
{command: "D02E" + // Length
"8103011300" + // Command details
"82028183" + // Device identities
"86099111223344556677F8" + // Address
"8B180100099110325476F840F40C54657374204D657373616765", // 3GPP-SMS TPDU
expect: {commandQualifier: 0x00}},
{command: "d032810301130182028183850753656e6420534d86099111223344556677f88b130100099110325476f840f40753656e6420534d",
expect: {commandQualifier: 0x01,
text: "Send SM"}},
{command: "d02981030113018202818386099111223344556677f88b130100099110325476f840f40753656e6420534d",
expect: {commandQualifier: 0x01}},
{command: "d03d810301130082028183850d53686f7274204d65737361676586099111223344556677f88b180100099110325476f840f00d53f45b4e0735cbf379f85c06",
{command: "D03D" + // Length
"8103011300" + // Command details
"82028183" + // Device identities
"850D53686F7274204D657373616765" + // Alpha identifier
"86099111223344556677F8" + // Address
"8B180100099110325476F840F00D53F45B4E0735CBF379F85C06", // 3GPP-SMS TPDU
expect: {commandQualifier: 0x00,
text: "Short Message"}},
{command: "d02e81030113008202818386099111223344556677f88b180100099110325476f840f00d53f45b4e0735cbf379f85c06",
expect: {commandQualifier: 0x00}},
{command: "d081fd810301130182028183853854686520616464726573732064617461206f626a65637420686f6c6473207468652052501144657374696e6174696f6e114164647265737386099111223344556677f88b81ac0100099110325476f840f4a054776f2074797065732061726520646566696e65643a202d20412073686f7274206d65737361676520746f2062652073656e7420746f20746865206e6574776f726b20696e20616e20534d532d5355424d4954206d6573736167652c206f7220616e20534d532d434f4d4d414e44206d6573736167652c20776865726520746865207573657220646174612063616e20626520706173736564207472616e7370",
{command: "D081FD" + // Length
"8103011301" + // Command details
"82028183" + // Device identities
"853854686520616464726573732064617461206F62" + // Alpha identifier
"6A65637420686F6C64732074686520525011446573" +
"74696E6174696F6E1141646472657373" +
"86099111223344556677F8" + // Address
"8B81AC0100099110325476F840F4A054776F20747970" + // 3GPP-SMS TPDU
"65732061726520646566696E65643A202D2041207368" +
"6F7274206D65737361676520746F2062652073656E74" +
"20746F20746865206E6574776F726B20696E20616E20" +
"534D532D5355424D4954206D6573736167652C206F72" +
"20616E20534D532D434F4D4D414E44206D6573736167" +
"652C2077686572652074686520757365722064617461" +
"2063616E20626520706173736564207472616E7370",
expect: {commandQualifier: 0x01,
text: "The address data object holds the RP_Destination_Address"}},
{command: "d081c381030113018202818386099111223344556677f88b81ac0100099110325476f840f4a054776f2074797065732061726520646566696e65643a202d20412073686f7274206d65737361676520746f2062652073656e7420746f20746865206e6574776f726b20696e20616e20534d532d5355424d4954206d6573736167652c206f7220616e20534d532d434f4d4d414e44206d6573736167652c20776865726520746865207573657220646174612063616e20626520706173736564207472616e7370",
{command: "D081C3" + // Length
"8103011301" + // Command details
"82028183" + // Device identities
"86099111223344556677F8" + // Address
"8B81AC0100099110325476F840F4A054776F20747970" + // 3GPP-SMS TPDU
"65732061726520646566696E65643A202D2041207368" +
"6F7274206D65737361676520746F2062652073656E74" +
"20746F20746865206E6574776F726B20696E20616E20" +
"534D532D5355424D4954206D6573736167652C206F72" +
"20616E20534D532D434F4D4D414E44206D6573736167" +
"652C2077686572652074686520757365722064617461" +
"2063616E20626520706173736564207472616E7370",
expect: {commandQualifier: 0x01}},
{command: "d081e9810301130082028183853854686520616464726573732064617461206f626a65637420686f6c6473207468652052502044657374696e6174696f6e204164647265737386099111223344556677f88b81980100099110325476f840f0a0d4fb1b44cfc3cb7350585e0691cbe6b4bb4cd6815aa020688e7ecbe9a076793e0f9fcb20fa1b242e83e665371d447f83e8e832c85da6dfdff23528ed0685dda06973da9a5685cd2415d42ecfe7e17399057acb41613768da9cb686cf6633e82482dae5f93c7c2eb3407774595e06d1d165507d5e9683c8617a18340ebb41e232081e9ecfcb64105d1e76cfe1",
{command: "D081FD" + // Length
"8103011300" + // Command details
"82028183" + // Device identities
"8581E654776F207479706573206172652064656669" + // Alpha identifier
"6E65643A202D20412073686F7274206D6573736167" +
"6520746F2062652073656E7420746F20746865206E" +
"6574776F726B20696E20616E20534D532D5355424D" +
"4954206D6573736167652C206F7220616E20534D53" +
"2D434F4D4D414E44206D6573736167652C20776865" +
"726520746865207573657220646174612063616E20" +
"626520706173736564207472616E73706172656E74" +
"6C793B202D20412073686F7274206D657373616765" +
"20746F2062652073656E7420746F20746865206E65" +
"74776F726B20696E20616E20534D532D5355424D49" +
"5420" +
"8B09010002911040F00120", // 3GPP-SMS TPDU
expect: {commandQualifier: 0x00,
text: "The address data object holds the RP Destination Address"}},
{command: "d081af81030113008202818386099111223344556677f88b81980100099110325476f840f0a0d4fb1b44cfc3cb7350585e0691cbe6b4bb4cd6815aa020688e7ecbe9a076793e0f9fcb20fa1b242e83e665371d447f83e8e832c85da6dfdff23528ed0685dda06973da9a5685cd2415d42ecfe7e17399057acb41613768da9cb686cf6633e82482dae5f93c7c2eb3407774595e06d1d165507d5e9683c8617a18340ebb41e232081e9ecfcb64105d1e76cfe1",
expect: {commandQualifier: 0x00}},
{command: "d081fd8103011300820281838581e654776f2074797065732061726520646566696e65643a202d20412073686f7274206d65737361676520746f2062652073656e7420746f20746865206e6574776f726b20696e20616e20534d532d5355424d4954206d6573736167652c206f7220616e20534d532d434f4d4d414e44206d6573736167652c20776865726520746865207573657220646174612063616e20626520706173736564207472616e73706172656e746c793b202d20412073686f7274206d65737361676520746f2062652073656e7420746f20746865206e6574776f726b20696e20616e20534d532d5355424d4954208b09010002911040f00120",
expect: {commandQualifier: 0x00,
text: "Two types are defined: - A short message to be sent to the network in an SMS-SUBMIT message, or an SMS-COMMAND message, where the user data can be passed transparently; - A short message to be sent to the network in an SMS-SUBMIT "}},
{command: "d0148103011300820281838b09010002911040f00120",
expect: {commandQualifier: 0x00}},
{command: "d030810301130082028183850086099111223344556677f88b180100099110325476f840f40c54657374204d657373616765",
func: testSendSMS,
text: "Two types are defined: - A short message to be sent to " +
"the network in an SMS-SUBMIT message, or an SMS-COMMAND " +
"message, where the user data can be passed transparently; " +
"- A short message to be sent to the network in an " +
"SMS-SUBMIT "}},
{command: "D030" + // Length
"8103011300" + // Command details
"82028183" + // Device identities
"8500" + // Alpha identifier
"86099111223344556677F8" + // Address
"8B180100099110325476F840F40C54657374204D657373616765", // 3GPP-SMS TPDU
expect: {commandQualifier: 0x00,
text: ""}},
{command: "d05581030113008202818385198004170414042004100412042104220412042304190422041586099111223344556677f88b240100099110325476f8400818041704140420041004120421042204120423041904220415",
{command: "D055" + // Length
"8103011300" + // Command details
"82028183" + // Device identities
"851980041704140420041004120421042204120423041904220415" + // Alpha identifier
"86099111223344556677F8" + // Address
"8B240100099110325476F8400818041704140420041004120421042204120423041904220415", // 3GPP-SMS TPDU
expect: {commandQualifier: 0x00,
text: "ЗДРАВСТВУЙТЕ"}},
{command: "d03a81030113008202818386099111223344556677f88b240100099110325476f8400818041704140420041004120421042204120423041904220415",
expect: {commandQualifier: 0x00}},
{command: "d04b810301130082028183850f810c089794a09092a1a292a399a29586099111223344556677f88b240100099110325476f8400818041704140420041004120421042204120423041904220415",
{command: "D04B" + // Length
"8103011300" + // Command details
"82028183" + // Device identities
"850F810C089794A09092A1A292A399A295" + // Alpha identifier
"86099111223344556677F8" + // Address
"8B240100099110325476F8400818041704140420041004120421042204120423041904220415", // 3GPP-SMS TPDU
expect: {commandQualifier: 0x00,
text: "ЗДРАВСТВУЙТЕ"}},
{command: "d03b81030113008202818385074e4f2049434f4e86099111223344556677f88b180100099110325476f840f40c54657374204d6573736167659e020002",
{command: "D03B" + // Length
"8103011300" + // Command details
"82028183" + // Device identities
"85074E4F2049434F4E" + // Alpha identifier
"86099111223344556677F8" + // Address
"8B180100099110325476F840F40C54657374204D657373616765" + // 3GPP-SMS TPDU
"9E020002", // Icon identifier
expect: {commandQualifier: 0x00,
// The record number 02 in EFimg is not defined, so no icon will be
// shown, but the text string should still be displayed.
text: "NO ICON"}},
{command: "d03281030113008202818386099111223344556677f88b180100099110325476f840f40c54657374204d6573736167659e020001",
{command: "D032" + // Length
"8103011300" + // Command details
"82028183" + // Device identities
"86099111223344556677F8" + // Address
"8B180100099110325476F840F40C54657374204D657373616765" + // 3GPP-SMS TPDU
"9E020001", // Icon identifier
expect: {commandQualifier: 0x00,
iconSelfExplanatory: true,
icons: [BASIC_ICON]}},
{command: "d03b810301130082028183850753656e6420534d86099111223344556677f88b180100099110325476f840f40c54657374204d6573736167651e020101",
{command: "D03B" + // Length
"8103011300" + // Command details
"82028183" + // Device identities
"850753656E6420534D" + // Alpha identifier
"86099111223344556677F8" + // Address
"8B180100099110325476F840F40C54657374204D657373616765" + // 3GPP-SMS TPDU
"1E020101", // Icon identifier
expect: {commandQualifier: 0x00,
text: "Send SM",
iconSelfExplanatory: false,
icons: [BASIC_ICON]}},
{command: "d03281030113008202818386099111223344556677f88b180100099110325476f840f40c54657374204d6573736167651e020101",
expect: {commandQualifier: 0x00,
iconSelfExplanatory: false,
icons: [BASIC_ICON]}},
{command: "d02c8103011300820281838510546578742041747472696275746520318b09010002911040f00120d004001000b4",
{command: "D02C" + // Length
"8103011300" + // Command details
"82028183" + // Device identities
"851054657874204174747269627574652031" + // Alpha identifier
"8B09010002911040F00120" + // 3GPP-SMS TPDU
"D004001000B4", // Text attribute
expect: {commandQualifier: 0x00,
text: "Text Attribute 1"}},
{command: "d01a8103011300820281838b09010002911040f00120d004001000b4",
expect: {commandQualifier: 0x00}},
{command: "d0268103011300820281838510546578742041747472696275746520328b09010002911040f00120",
expect: {commandQualifier: 0x00,
text: "Text Attribute 2"}},
{command: "d02c8103011300820281838510546578742041747472696275746520318b09010002911040f00120d004001001b4",
expect: {commandQualifier: 0x00,
text: "Text Attribute 1"}},
{command: "d01a8103011300820281838b09010002911040f00120d004001001b4",
expect: {commandQualifier: 0x00}},
{command: "d02c8103011300820281838510546578742041747472696275746520318b09010002911040f00120d004001002b4",
expect: {commandQualifier: 0x00,
text: "Text Attribute 1"}},
{command: "d01a8103011300820281838b09010002911040f00120d004001002b4",
expect: {commandQualifier: 0x00}},
{command: "d02c8103011300820281838510546578742041747472696275746520318b09010002911040f00120d004001004b4",
expect: {commandQualifier: 0x00,
text: "Text Attribute 1"}},
{command: "d01a8103011300820281838b09010002911040f00120d004001004b4",
expect: {commandQualifier: 0x00}},
{command: "d02c8103011300820281838510546578742041747472696275746520328b09010002911040f00120d004001000b4",
expect: {commandQualifier: 0x00,
text: "Text Attribute 2"}},
{command: "d0268103011300820281838510546578742041747472696275746520338b09010002911040f00120",
expect: {commandQualifier: 0x00,
text: "Text Attribute 3"}},
{command: "d02c8103011300820281838510546578742041747472696275746520318b09010002911040f00120d004001008b4",
expect: {commandQualifier: 0x00,
text: "Text Attribute 1"}},
{command: "d01a8103011300820281838b09010002911040f00120d004001008b4",
expect: {commandQualifier: 0x00}},
{command: "d02c8103011300820281838510546578742041747472696275746520318b09010002911040f00120d004001010b4",
expect: {commandQualifier: 0x00,
text: "Text Attribute 1"}},
{command: "d01a8103011300820281838b09010002911040f00120d004001010b4",
expect: {commandQualifier: 0x00}},
{command: "d02c8103011300820281838510546578742041747472696275746520318b09010002911040f00120d004001020b4",
expect: {commandQualifier: 0x00,
text: "Text Attribute 1"}},
{command: "d01a8103011300820281838b09010002911040f00120d004001020b4",
expect: {commandQualifier: 0x00}},
{command: "d02c8103011300820281838510546578742041747472696275746520318b09010002911040f00120d004001040b4",
expect: {commandQualifier: 0x00,
text: "Text Attribute 1"}},
{command: "d01a8103011300820281838b09010002911040f00120d004001040b4",
expect: {commandQualifier: 0x00}},
{command: "d02c8103011300820281838510546578742041747472696275746520318b09010002911040f00120d004001080b4",
expect: {commandQualifier: 0x00,
text: "Text Attribute 1"}},
{command: "d01a8103011300820281838b09010002911040f00120d004001080b4",
expect: {commandQualifier: 0x00}},
{command: "d02d8103011300820281838505804e2d4e0086099111223344556677f88b100100099110325476f84008044e2d4e00",
expect: {commandQualifier: 0x00,
text: "中一"}},
{command: "d02681030113008202818386099111223344556677f88b100100099110325476f84008044e2d4e00",
expect: {commandQualifier: 0x00}},
{command: "d02d810301130082028183850581029cad8086099111223344556677f88b100100099110325476f84008044e2d4e00",
expect: {commandQualifier: 0x00,
text: "中一"}},
{command: "d02e810301130082028183850682024e00ad8086099111223344556677f88b100100099110325476f84008044e2d4e00",
expect: {commandQualifier: 0x00,
text: "中一"}},
{command: "d0358103011300820281838509800038003030eb003086099111223344556677f88b140100099110325476f84008080038003030eb0031",
expect: {commandQualifier: 0x00,
{command: "D035" + // Length
"8103011300" + // Command details
"82028183" + // Device identities
"8509800038003030EB0030" + // Alpha identifier
"86099111223344556677F8" + // Address
"8B140100099110325476F84008080038003030EB0031",
expect: {commandQualifier: 0x00, // 3GPP-SMS TPDU
text: "80ル0"}},
{command: "d02a81030113008202818386099111223344556677f88b140100099110325476f84008080038003030eb0031",
expect: {commandQualifier: 0x00}},
{command: "d03381030113008202818385078104613831eb3186099111223344556677f88b140100099110325476f84008080038003030eb0032",
expect: {commandQualifier: 0x00,
{command: "D033" + // Length
"8103011300" + // Command details
"82028183" + // Device identities
"85078104613831EB31" + // Alpha identifier
"86099111223344556677F8" + // Address
"8B140100099110325476F84008080038003030EB0032",
expect: {commandQualifier: 0x00, // 3GPP-SMS TPDU
text: "81ル1"}},
{command: "d02a81030113008202818386099111223344556677f88b140100099110325476f84008080038003030eb0032",
expect: {commandQualifier: 0x00}},
{command: "d0348103011300820281838508820430a03832cb3286099111223344556677f88b140100099110325476f84008080038003030eb0033",
expect: {commandQualifier: 0x00,
{command: "D034" + // Length
"8103011300" + // Command details
"82028183" + // Device identities
"8508820430A03832CB32" + // Alpha identifier
"86099111223344556677F8" + // Address
"8B140100099110325476F84008080038003030EB0033",
expect: {commandQualifier: 0x00, // 3GPP-SMS TPDU
text: "82ル2"}},
{command: "d02a81030113008202818386099111223344556677f88b140100099110325476f84008080038003030eb0033",
expect: {commandQualifier: 0x00}}
];
function testSendSMS(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SEND_SMS, "typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
if (aExpect.text) {
// text is optional.
if ("text" in aExpect) {
is(aCommand.options.text, aExpect.text, "options.text");
}
if (aExpect.icons) {
// icons is optional.
if ("icons" in aExpect) {
isIcons(aCommand.options.icons, aExpect.icons);
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
"options.iconSelfExplanatory");
@ -175,6 +191,12 @@ startTestCommon(function() {
// Wait onstkcommand event.
promises.push(waitForTargetEvent(icc, "stkcommand")
.then((aEvent) => testSendSMS(aEvent.command, data.expect)));
// Wait icc-stkcommand system message.
promises.push(waitForSystemMessage("icc-stkcommand")
.then((aMessage) => {
is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
testSendSMS(aMessage.command, data.expect);
}));
// Send emulator command to generate stk unsolicited event.
promises.push(sendEmulatorStkPdu(data.command));

Просмотреть файл

@ -5,127 +5,101 @@ MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "d029810301110082028183850c43616c6c20466f7277617264891091aa120a214365870921436587a901fb",
{command: "D029" + // Length
"8103011100" + // Command details
"82028183" + // Device identities
"850C43616C6C20466F7277617264" + // Alpha identifier
"891091AA120A214365870921436587A901FB", // SS string
expect: {commandQualifier: 0x00,
text: "Call Forward"}},
{command: "d01b810301110082028183891091aa120a214365870921436587a901fb",
expect: {name: "send_ss_cmd_1_without_alpha_identifier",
commandQualifier: 0x00}},
{command: "d02d810301110082028183850c43616c6c20466f7277617264891491aa120a21436587092143658709214365a711fb",
expect: {name: "send_ss_cmd_2_with_alpha_identifier",
commandQualifier: 0x00,
text: "Call Forward"}},
{command: "d01f810301110082028183891491aa120a21436587092143658709214365a711fb",
{command: "D01B" + // Length
"8103011100" + // Command details
"82028183" + // Device identities
"891091AA120A214365870921436587A901FB", // SS string
expect: {commandQualifier: 0x00}},
{command: "d081fd8103011100820281838581eb4576656e20696620746865204669786564204469616c6c696e67204e756d626572207365727669636520697320656e61626c65642c2074686520737570706c656d656e74617279207365727669636520636f6e74726f6c20737472696e6720696e636c7564656420696e207468652053454e442053532070726f61637469766520636f6d6d616e64207368616c6c206e6f7420626520636865636b656420616761696e73742074686f7365206f66207468652046444e206c6973742e2055706f6e20726563656976696e67207468697320636f6d6d616e642c20746865204d45207368616c6c20646563698904ffba13fb",
{command: "D081FD" + // Length
"8103011100" + // Command details
"82028183" + // Device identities
"8581EB4576656E2069662074686520466978656420" + // Alpha identifier
"4469616C6C696E67204E756D626572207365727669" +
"636520697320656E61626C65642C20746865207375" +
"70706C656D656E7461727920736572766963652063" +
"6F6E74726F6C20737472696E6720696E636C756465" +
"6420696E207468652053454E442053532070726F61" +
"637469766520636F6D6D616E64207368616C6C206E" +
"6F7420626520636865636B656420616761696E7374" +
"2074686F7365206F66207468652046444E206C6973" +
"742E2055706F6E20726563656976696E6720746869" +
"7320636F6D6D616E642C20746865204D4520736861" +
"6C6C2064656369" +
"8904FFBA13FB", // SS string
expect: {commandQualifier: 0x00,
text: "Even if the Fixed Dialling Number service is enabled, the supplementary service control string included in the SEND SS proactive command shall not be checked against those of the FDN list. Upon receiving this command, the ME shall deci"}},
{command: "d00f8103011100820281838904ffba13fb",
expect: {commandQualifier: 0x00}},
{command: "d01d8103011100820281838500891091aa120a214365870921436587a901fb",
text: "Even if the Fixed Dialling Number service is enabled, " +
"the supplementary service control string included in the " +
"SEND SS proactive command shall not be checked against " +
"those of the FDN list. Upon receiving this command, the " +
"ME shall deci"}},
{command: "D01D" + // Length
"8103011100" + // Command details
"82028183" + // Device identities
"8500" + // Alpha identifier
"891091AA120A214365870921436587A901FB", // SS string
expect: {commandQualifier: 0x00,
text: ""}},
{command: "d02b810301110082028183850a42617369632049636f6e891091aa120a214365870921436587a901fb9e020001",
{command: "D02B" + // Length
"8103011100" + // Command details
"82028183" + // Device identities
"850A42617369632049636F6E" + // Alpha identifier
"891091AA120A214365870921436587A901FB" + // SS string
"9E020001", // Icon identifier
expect: {commandQualifier: 0x00,
text: "Basic Icon",
iconSelfExplanatory: true,
icons: [BASIC_ICON]}},
{command: "d01f810301110082028183891091aa120a214365870921436587a901fb9e020001",
expect: {commandQualifier: 0x00,
iconSelfExplanatory: true,
icons: [BASIC_ICON]}},
{command: "d02c810301110082028183850b436f6c6f75722049636f6e891091aa120a214365870921436587a901fb9e020003",
expect: {commandQualifier: 0x00,
text: "Colour Icon",
iconSelfExplanatory: true,
icons: [COLOR_ICON]}},
{command: "d01f810301110082028183891091aa120a214365870921436587a901fb9e020003",
expect: {commandQualifier: 0x00,
iconSelfExplanatory: true,
icons: [COLOR_ICON]}},
{command: "d02b810301110082028183850a42617369632049636f6e891091aa120a214365870921436587a901fb9e020101",
expect: {commandQualifier: 0x00,
text: "Basic Icon",
iconSelfExplanatory: false,
icons: [BASIC_ICON]}},
{command: "d01f810301110082028183891091aa120a214365870921436587a901fb9e020101",
{command: "D01F" + // Length
"8103011100" + // Command details
"82028183" + // Device identities
"891091AA120A214365870921436587A901FB" + // SS string
"9E020103", // Icon identifier
expect: {commandQualifier: 0x00,
iconSelfExplanatory: false,
icons: [BASIC_ICON]}},
{command: "d036810301110082028183851980041704140420041004120421042204120423041904220415891091aa120a214365870921436587a901fb",
icons: [COLOR_ICON]}},
{command: "D036" + // Length
"8103011100" + // Command details
"82028183" + // Device identities
"851980041704140420041004120421042204120423041904220415" + // Alpha identifier
"891091AA120A214365870921436587A901FB", // SS string
expect: {commandQualifier: 0x00,
text: "ЗДРАВСТВУЙТЕ"}},
{command: "d033810301110082028183851054657874204174747269627574652031891091aa120a214365870921436587a901fbd004001000b4",
{command: "D033" + // Length
"8103011100" + // Command details
"82028183" + // Device identities
"851054657874204174747269627574652031" + // Alpha identifier
"891091AA120A214365870921436587A901FB" + // SS string
"D004001000B4", // Text attribute
expect: {commandQualifier: 0x00,
text: "Text Attribute 1"}},
{command: "d021810301110082028183891091aa120a214365870921436587a901fbd004001000b4",
expect: {commandQualifier: 0x00}},
{command: "d02d810301110082028183851054657874204174747269627574652032891091aa120a214365870921436587a901fb",
expect: {commandQualifier: 0x00,
text: "Text Attribute 2"}},
{command: "d033810301110082028183851054657874204174747269627574652031891091aa120a214365870921436587a901fbd004001001b4",
expect: {commandQualifier: 0x00,
text: "Text Attribute 1"}},
{command: "d021810301110082028183891091aa120a214365870921436587a901fbd004001001b4",
expect: {commandQualifier: 0x00}},
{command: "d033810301110082028183851054657874204174747269627574652031891091aa120a214365870921436587a901fbd004001002b4",
expect: {commandQualifier: 0x00,
text: "Text Attribute 1"}},
{command: "d021810301110082028183891091aa120a214365870921436587a901fbd004001002b4",
expect: {commandQualifier: 0x00}},
{command: "d033810301110082028183851054657874204174747269627574652031891091aa120a214365870921436587a901fbd004001004b4",
expect: {commandQualifier: 0x00,
text: "Text Attribute 1"}},
{command: "d021810301110082028183891091aa120a214365870921436587a901fbd004001004b4",
expect: {commandQualifier: 0x00}},
{command: "d033810301110082028183851054657874204174747269627574652032891091aa120a214365870921436587a901fbd004001000b4",
expect: {commandQualifier: 0x00,
text: "Text Attribute 2"}},
{command: "d02d810301110082028183851054657874204174747269627574652033891091aa120a214365870921436587a901fb",
expect: {commandQualifier: 0x00,
text: "Text Attribute 3"}},
{command: "d033810301110082028183851054657874204174747269627574652031891091aa120a214365870921436587a901fbd004001008b4",
expect: {commandQualifier: 0x00,
text: "Text Attribute 1"}},
{command: "d021810301110082028183891091aa120a214365870921436587a901fbd004001008b4",
expect: {commandQualifier: 0x00}},
{command: "d033810301110082028183851054657874204174747269627574652031891091aa120a214365870921436587a901fbd004001010b4",
expect: {commandQualifier: 0x00,
text: "Text Attribute 1"}},
{command: "d021810301110082028183891091aa120a214365870921436587a901fbd004001010b4",
expect: {commandQualifier: 0x00}},
{command: "d033810301110082028183851054657874204174747269627574652031891091aa120a214365870921436587a901fbd004001020b4",
expect: {commandQualifier: 0x00,
text: "Text Attribute 1"}},
{command: "d021810301110082028183891091aa120a214365870921436587a901fbd004001020b4",
expect: {commandQualifier: 0x00}},
{command: "d033810301110082028183851054657874204174747269627574652031891091aa120a214365870921436587a901fbd004001040b4",
expect: {commandQualifier: 0x00,
text: "Text Attribute 1"}},
{command: "d021810301110082028183891091aa120a214365870921436587a901fbd004001040b4",
expect: {commandQualifier: 0x00}},
{command: "d033810301110082028183851054657874204174747269627574652031891091aa120a214365870921436587a901fbd004001080b4",
expect: {commandQualifier: 0x00,
text: "Text Attribute 1"}},
{command: "d021810301110082028183891091aa120a214365870921436587a901fbd004001080b4",
expect: {commandQualifier: 0x00}},
{command: "d0228103011100820281838505804f60597d891091aa120a214365870921436587a901fb",
{command: "D022" + // Length
"8103011100" + // Command details
"82028183" + // Device identities
"8505804F60597D" + // Alpha identifier
"891091AA120A214365870921436587A901FB", // SS string
expect: {commandQualifier: 0x00,
text: "你好"}},
{command: "d02081030111008202818385038030eb891091aa120a214365870921436587a901fb",
expect: {commandQualifier: 0x00,
text: "ル"}},
];
function testSendSS(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SEND_SS, "typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
if (aExpect.text) {
// text is optional.
if ("text" in aExpect) {
is(aCommand.options.text, aExpect.text, "options.text");
}
if (aExpect.icons) {
// icons is optional.
if ("icons" in aExpect) {
isIcons(aCommand.options.icons, aExpect.icons);
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
"options.iconSelfExplanatory");
@ -145,6 +119,12 @@ startTestCommon(function() {
// Wait onstkcommand event.
promises.push(waitForTargetEvent(icc, "stkcommand")
.then((aEvent) => testSendSS(aEvent.command, data.expect)));
// Wait icc-stkcommand system message.
promises.push(waitForSystemMessage("icc-stkcommand")
.then((aMessage) => {
is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
testSendSS(aMessage.command, data.expect);
}));
// Send emulator command to generate stk unsolicited event.
promises.push(sendEmulatorStkPdu(data.command));

Просмотреть файл

@ -5,128 +5,139 @@ MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "d050810301120082028183850a372d62697420555353448a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
{command: "D050" + // Length
"8103011200" + // Command details
"82028183" + // Device identities
"850A372D6269742055535344" + // Alpha identifier
"8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string
"B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" +
"3B3EAF6FC564335ACD76C3E560",
expect: {commandQualifier: 0x00,
text: "7-bit USSD"}},
{command: "d0448103011200820281838a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
{command: "D044" + // Length
"8103011200" + // Command details
"82028183" + // Device identities
"8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string
"B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" +
"3B3EAF6FC564335ACD76C3E560",
expect: {commandQualifier: 0x00}},
{command: "d058810301120082028183850a382d62697420555353448a41444142434445464748494a4b4c4d4e4f505152535455565758595a2d6162636465666768696a6b6c6d6e6f707172737475767778797a2d31323334353637383930",
{command: "D058" + // Length
"8103011200" + // Command details
"82028183" + // Device identities
"850A382D6269742055535344" + // Alpha identifier
"8A41444142434445464748494A4B4C4D4E4F5051525354" + // USSD string
"55565758595A2D6162636465666768696A6B6C6D6E6F70" +
"7172737475767778797A2D31323334353637383930",
expect: {commandQualifier: 0x00,
text: "8-bit USSD"}},
{command: "d04c8103011200820281838a41444142434445464748494a4b4c4d4e4f505152535455565758595a2d6162636465666768696a6b6c6d6e6f707172737475767778797a2d31323334353637383930",
expect: {commandQualifier: 0x00}},
{command: "d02f81030112008202818385095543533220555353448a1948041704140420041004120421042204120423041904220415",
{command: "D02F" + // Length
"8103011200" + // Command details
"82028183" + // Device identities
"8509554353322055535344" + // Alpha identifier
"8A1948041704140420041004120421042204120423041904220415", // USSD string
expect: {commandQualifier: 0x00,
text: "UCS2 USSD"}},
{command: "d0248103011200820281838a1948041704140420041004120421042204120423041904220415",
expect: {commandQualifier: 0x00}},
{command: "d081fd8103011200820281838581b66f6e636520612052454c4541534520434f4d504c455445206d65737361676520636f6e7461696e696e672074686520555353442052657475726e20526573756c74206d657373616765206e6f7420636f6e7461696e696e6720616e206572726f7220686173206265656e2072656365697665642066726f6d20746865206e6574776f726b2c20746865204d45207368616c6c20696e666f726d207468652053494d20746861742074686520636f6d6d616e64206861738a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
{command: "D081FD" + // Length
"8103011200" + // Command details
"82028183" + // Device identities
"8581B66F6E636520612052454C4541534520434F4D" + // Alpha identifier
"504C455445206D65737361676520636F6E7461696E" +
"696E672074686520555353442052657475726E2052" +
"6573756C74206D657373616765206E6F7420636F6E" +
"7461696E696E6720616E206572726F722068617320" +
"6265656E2072656365697665642066726F6D207468" +
"65206E6574776F726B2C20746865204D4520736861" +
"6C6C20696E666F726D207468652053494D20746861" +
"742074686520636F6D6D616E6420686173" +
"8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string
"B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" +
"3B3EAF6FC564335ACD76C3E560",
expect: {commandQualifier: 0x00,
text: "once a RELEASE COMPLETE message containing the USSD Return Result message not containing an error has been received from the network, the ME shall inform the SIM that the command has"}},
{command: "d04681030112008202818385008a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
text: "once a RELEASE COMPLETE message containing the USSD " +
"Return Result message not containing an error has been " +
"received from the network, the ME shall inform the SIM " +
"that the command has"}},
{command: "D046" + // Length
"8103011200" + // Command details
"82028183" + // Device identities
"8500" + // Alpha identifier
"8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string
"B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" +
"3B3EAF6FC564335ACD76C3E560",
expect: {commandQualifier: 0x00,
text: ""}},
{command: "d054810301120082028183850a42617369632049636f6e8a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e5609e020001",
{command: "D054" + // Length
"8103011200" + // Command details
"82028183" + // Device identities
"850A42617369632049636F6E" + // Alpha identifier
"8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string
"B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" +
"3B3EAF6FC564335ACD76C3E560" +
"9E020001", // Icon identifier
expect: {commandQualifier: 0x00,
text: "Basic Icon",
iconSelfExplanatory: true,
icons: [BASIC_ICON]}},
{command: "d0488103011200820281838a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e5609e020001",
expect: {commandQualifier: 0x00,
iconSelfExplanatory: true,
icons: [BASIC_ICON]}},
{command: "d054810301120082028183850a436f6c6f722049636f6e8a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e5609e020003",
expect: {commandQualifier: 0x00,
text: "Color Icon",
iconSelfExplanatory: true,
icons: [COLOR_ICON]}},
{command: "d0488103011200820281838a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e5609e020003",
expect: {commandQualifier: 0x00,
iconSelfExplanatory: true,
icons: [COLOR_ICON]}},
{command: "d054810301120082028183850a42617369632049636f6e8a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e5609e020101",
expect: {commandQualifier: 0x00,
text: "Basic Icon",
iconSelfExplanatory: false,
icons: [BASIC_ICON]}},
{command: "d0488103011200820281838a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e5609e020101",
{command: "D048" + // Length
"8103011200" + // Command details
"82028183" + // Device identities
"8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string
"B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" +
"3B3EAF6FC564335ACD76C3E560" +
"9E020103", // Icon identifier
expect: {commandQualifier: 0x00,
iconSelfExplanatory: false,
icons: [BASIC_ICON]}},
{command: "d05f8103011200820281838519800417041404200410041204210422041204230419042204158a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
icons: [COLOR_ICON]}},
{command: "D05F" + // Length
"8103011200" + // Command details
"82028183" + // Device identities
"851980041704140420041004120421042204120423041904220415" + // Alpha identifier
"8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string
"B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" +
"3B3EAF6FC564335ACD76C3E560",
expect: {commandQualifier: 0x00,
text: "ЗДРАВСТВУЙТЕ"}},
{command: "d05c8103011200820281838510546578742041747472696275746520318a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001000b4",
{command: "D05C" + // Length
"8103011200" + // Command details
"82028183" + // Device identities
"851054657874204174747269627574652031" + // Alpha identifier
"8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string
"B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" +
"3B3EAF6FC564335ACD76C3E560" +
"D004001000B4", // Text attribute
expect: {commandQualifier: 0x00,
text: "Text Attribute 1"}},
{command: "d04a8103011200820281838a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001000b4",
{command: "D04A" + // Length
"8103011200" + // Command details
"82028183" + // Device identities
"8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string
"B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" +
"3B3EAF6FC564335ACD76C3E560" +
"D004001000B4", // Text attribute
expect: {commandQualifier: 0x00}},
{command: "d0568103011200820281838510546578742041747472696275746520328a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
expect: {commandQualifier: 0x00,
text: "Text Attribute 2"}},
{command: "d05c8103011200820281838510546578742041747472696275746520318a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001001b4",
expect: {commandQualifier: 0x00,
text: "Text Attribute 1"}},
{command: "d04a8103011200820281838a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001001b4",
expect: {commandQualifier: 0x00}},
{command: "d05c8103011200820281838510546578742041747472696275746520318a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001002b4",
expect: {commandQualifier: 0x00,
text: "Text Attribute 1"}},
{command: "d04a8103011200820281838a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001002b4",
expect: {commandQualifier: 0x00}},
{command: "d05c8103011200820281838510546578742041747472696275746520318a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001004b4",
expect: {commandQualifier: 0x00,
text: "Text Attribute 1"}},
{command: "d04a8103011200820281838a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001004b4",
expect: {commandQualifier: 0x00}},
{command: "d05c8103011200820281838510546578742041747472696275746520328a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001000b4",
expect: {commandQualifier: 0x00,
text: "Text Attribute 2"}},
{command: "d0568103011200820281838510546578742041747472696275746520338a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
expect: {commandQualifier: 0x00,
text: "Text Attribute 3"}},
{command: "d05c8103011200820281838510546578742041747472696275746520318a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001008b4",
expect: {commandQualifier: 0x00,
text: "Text Attribute 1"}},
{command: "d04a8103011200820281838a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001008b4",
expect: {commandQualifier: 0x00}},
{command: "d05c8103011200820281838510546578742041747472696275746520318a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001010b4",
expect: {commandQualifier: 0x00,
text: "Text Attribute 1"}},
{command: "d04a8103011200820281838a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001010b4",
expect: {commandQualifier: 0x00}},
{command: "d05c8103011200820281838510546578742041747472696275746520318a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001020b4",
expect: {commandQualifier: 0x00,
text: "Text Attribute 1"}},
{command: "d04a8103011200820281838a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001020b4",
expect: {commandQualifier: 0x00}},
{command: "d05c8103011200820281838510546578742041747472696275746520318a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001040b4",
expect: {commandQualifier: 0x00,
text: "Text Attribute 1"}},
{command: "d04a8103011200820281838a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001040b4",
expect: {commandQualifier: 0x00}},
{command: "d05c8103011200820281838510546578742041747472696275746520318a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001080b4",
expect: {commandQualifier: 0x00,
text: "Text Attribute 1"}},
{command: "d04a8103011200820281838a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001080b4",
expect: {commandQualifier: 0x00}},
{command: "d04b8103011200820281838505804f60597d8a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
{command: "D04B" + // Length
"8103011200" + // Command details
"82028183" + // Device identities
"8505804F60597D" + // Alpha identifier
"8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string
"B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" +
"3B3EAF6FC564335ACD76C3E560",
expect: {commandQualifier: 0x00,
text: "你好"}},
{command: "d04981030112008202818385038030eb8a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
expect: {commandQualifier: 0x00,
text: "ル"}},
];
function testSendUSSD(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SEND_USSD, "typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
if (aExpect.text) {
// text is optional.
if ("text" in aExpect) {
is(aCommand.options.text, aExpect.text, "options.text");
}
if (aExpect.icons) {
// icons is optional.
if ("icons" in aExpect) {
isIcons(aCommand.options.icons, aExpect.icons);
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
"options.iconSelfExplanatory");
@ -146,6 +157,12 @@ startTestCommon(function() {
// Wait onstkcommand event.
promises.push(waitForTargetEvent(icc, "stkcommand")
.then((aEvent) => testSendUSSD(aEvent.command, data.expect)));
// Wait icc-stkcommand system message.
promises.push(waitForSystemMessage("icc-stkcommand")
.then((aMessage) => {
is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
testSendUSSD(aMessage.command, data.expect);
}));
// Send emulator command to generate stk unsolicited event.
promises.push(sendEmulatorStkPdu(data.command));

Просмотреть файл

@ -5,247 +5,174 @@ MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "d01e81030110008202818385084e6f7420627573798609911032042143651c2c",
{command: "D01E" + // Length
"8103011000" + // Command details
"82028183" + // Device identities
"85084E6F742062757379" + // Alpha identifier
"8609911032042143651C2C", // Address
expect: {commandQualifier: 0x00,
confirmMessage: { text: "Not busy" },
address: "+012340123456,1,2"}},
{command: "d01d81030110028202818385074f6e20686f6c648609911032042143651c2c",
{command: "D01D" + // Length
"8103011002" + // Command details
"82028183" + // Device identities
"85074F6E20686F6C64" + // Alpha identifier
"8609911032042143651C2C", // Address
expect: {commandQualifier: 0x02,
confirmMessage: { text: "On hold" },
address: "+012340123456,1,2"}},
{command: "d020810301100482028183850a446973636f6e6e6563748609911032042143651c2c",
{command: "D020" + // Length
"8103011004" + // Command details
"82028183" + // Device identities
"850A446973636F6E6E656374" + // Alpha identifier
"8609911032042143651C2C", // Address
expect: {commandQualifier: 0x04,
confirmMessage: { text: "Disconnect" },
address: "+012340123456,1,2"}},
{command: "d02b81030110008202818385114361706162696c69747920636f6e6669678609911032042143651c2c870201a0",
{command: "D02B" + // Length
"8103011000" + // Command details
"82028183" + // Device identities
"85114361706162696C69747920636F6E666967" + // Alpha identifier
"8609911032042143651C2C" + // Address
"870201A0", // Capability configuration parameters
expect: {commandQualifier: 0x00,
confirmMessage: { text: "Capability config" },
address: "+012340123456,1,2"}},
{command: "d01c81030110018202818386119110325476981032547698103254769810",
{command: "D01C" + // Length
"8103011001" + // Command details
"82028183" + // Device identities
"86119110325476981032547698103254769810", // Address
expect: {commandQualifier: 0x01,
address: "+01234567890123456789012345678901"}},
{command: "d081fd8103011001820281838581ed54687265652074797065732061726520646566696e65643a202d2073657420757020612063616c6c2c20627574206f6e6c79206966206e6f742063757272656e746c792062757379206f6e20616e6f746865722063616c6c3b202d2073657420757020612063616c6c2c2070757474696e6720616c6c206f746865722063616c6c732028696620616e7929206f6e20686f6c643b202d2073657420757020612063616c6c2c20646973636f6e6e656374696e6720616c6c206f746865722063616c6c732028696620616e79292066697273742e20466f722065616368206f662074686573652074797065732c2086029110",
{command: "D081FD" + // Length
"8103011001" + // Command details
"82028183" + // Device identities
"8581ED546872656520747970657320617265206465" + // Alpha identifier
"66696E65643A202D2073657420757020612063616C" +
"6C2C20627574206F6E6C79206966206E6F74206375" +
"7272656E746C792062757379206F6E20616E6F7468" +
"65722063616C6C3B202D2073657420757020612063" +
"616C6C2C2070757474696E6720616C6C206F746865" +
"722063616C6C732028696620616E7929206F6E2068" +
"6F6C643B202D2073657420757020612063616C6C2C" +
"20646973636F6E6E656374696E6720616C6C206F74" +
"6865722063616C6C732028696620616E7929206669" +
"7273742E20466F722065616368206F662074686573" +
"652074797065732C20" +
"86029110", // Address
expect: {commandQualifier: 0x01,
confirmMessage: { text: "Three types are defined: - set up a call, but only if not currently busy on another call; - set up a call, putting all other calls (if any) on hold; - set up a call, disconnecting all other calls (if any) first. For each of these types, " },
confirmMessage: {
text: "Three types are defined: - set up a call, but only if " +
"not currently busy on another call; - set up a call, " +
"putting all other calls (if any) on hold; - set up a " +
"call, disconnecting all other calls (if any) first. For " +
"each of these types, "
},
address: "+01"}},
{command: "d02b810301100082028183850c43616c6c65642070617274798609911032042143651c2c880780509595959595",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "Called party" },
address: "+012340123456,1,2"}},
{command: "d02281030110018202818385084475726174696f6e8609911032042143651c2c8402010a",
{command: "D022" + // Length
"8103011001" + // Command details
"82028183" + // Device identities
"85084475726174696F6E" + // Alpha identifier
"8609911032042143651C2C" + // Address
"8402010A", // Duration
expect: {commandQualifier: 0x01,
confirmMessage: { text: "Duration" },
address: "+012340123456,1,2",
duration: {timeUnit: MozIccManager.STK_TIME_UNIT_SECOND,
timeInterval: 0x0A}}},
{command: "d028810301100082028183850c434f4e4649524d4154494f4e8609911032042143651c2c850443414c4c",
{command: "D028" + // Length
"8103011000" + // Command details
"82028183" + // Device identities
"850C434F4E4649524D4154494F4E" + // Alpha identifier
"8609911032042143651C2C" + // Address
"850443414C4C", // Alpha identifier
expect: {commandQualifier: 0x00,
confirmMessage: { text: "CONFIRMATION" },
callMessage: { text: "CALL" },
address: "+012340123456,1,2"}},
{command: "d03081030110008202818385165365742075702063616c6c2049636f6e20332e312e318609911032042143651c2c9e020101",
{command: "D030" + // Length
"8103011000" + // Command details
"82028183" + // Device identities
"85165365742075702063616C6C2049636F6E20332E312E31" + // Alpha identifier
"8609911032042143651C2C" + // Address
"9E020101", // Icon identifier
expect: {commandQualifier: 0x00,
confirmMessage: { text: "Set up call Icon 3.1.1",
iconSelfExplanatory: false,
icons: [BASIC_ICON] },
address: "+012340123456,1,2"}},
{command: "d03081030110008202818385165365742075702063616c6c2049636f6e20332e322e318609911032042143651c2c9e020001",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "Set up call Icon 3.2.1",
iconSelfExplanatory: true,
icons: [BASIC_ICON] },
address: "+012340123456,1,2"}},
{command: "d03081030110008202818385165365742075702063616c6c2049636f6e20332e332e318609911032042143651c2c9e020103",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "Set up call Icon 3.3.1",
iconSelfExplanatory: false,
icons: [COLOR_ICON] },
address: "+012340123456,1,2"}},
{command: "d04c81030110008202818385165365742075702063616c6c2049636f6e20332e342e318609911032042143651c2c9e02000185165365742075702063616c6c2049636f6e20332e342e329e020001",
{command: "D04C" + // Length
"8103011000" + // Command details
"82028183" + // Device identities
"85165365742075702063616C6C2049636F6E20332E342E31" + // Alpha identifier
"8609911032042143651C2C" + // Address
"9E020001" + // Icon identifier
"85165365742075702063616C6C2049636F6E20332E342E32" + // Alpha identifier
"9E020003", // Icon identifier
expect: {commandQualifier: 0x00,
confirmMessage: { text: "Set up call Icon 3.4.1",
iconSelfExplanatory: true,
icons: [BASIC_ICON] },
callMessage: { text: "Set up call Icon 3.4.2" },
callMessage: { text: "Set up call Icon 3.4.2" ,
iconSelfExplanatory: true,
icons: [COLOR_ICON] },
address: "+012340123456,1,2"}},
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20318609911032042143651c2c850643414c4c2031d004000e00b4d004000600b4",
{command: "D038" + // Length
"8103011000" + // Command details
"82028183" + // Device identities
"850E434F4E4649524D4154494F4E2031" + // Alpha identifier
"8609911032042143651C2C" + // Address
"850643414C4C2031" + // Alpha identifier
"D004000E00B4" + // Text attribute
"D004000600B4", // Text attribute
expect: {commandQualifier: 0x00,
confirmMessage: { text: "CONFIRMATION 1" },
callMessage: { text: "CALL 1" },
address: "+012340123456,1,2"}},
{command: "d02c810301100082028183850e434f4e4649524d4154494f4e20328609911032042143651c2c850643414c4c2032",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "CONFIRMATION 2" },
callMessage: { text: "CALL 2" },
address: "+012340123456,1,2"}},
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20318609911032042143651c2c850643414c4c2031d004000e01b4d004000601b4",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "CONFIRMATION 1" },
callMessage: { text: "CALL 1" },
address: "+012340123456,1,2"}},
{command: "d02c810301100082028183850e434f4e4649524d4154494f4e20328609911032042143651c2c850643414c4c2032",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "CONFIRMATION 2" },
callMessage: { text: "CALL 2" },
address: "+012340123456,1,2"}},
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20318609911032042143651c2c850643414c4c2031d004000e02b4d004000602b4",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "CONFIRMATION 1" },
callMessage: { text: "CALL 1" },
address: "+012340123456,1,2"}},
{command: "d02c810301100082028183850e434f4e4649524d4154494f4e20328609911032042143651c2c850643414c4c2032",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "CONFIRMATION 2" },
callMessage: { text: "CALL 2" },
address: "+012340123456,1,2"}},
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20318609911032042143651c2c850643414c4c2031d004000e04b4d004000604b4",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "CONFIRMATION 1" },
callMessage: { text: "CALL 1" },
address: "+012340123456,1,2"}},
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20328609911032042143651c2c850643414c4c2032d004000e00b4d004000600b4",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "CONFIRMATION 2" },
callMessage: { text: "CALL 2" },
address: "+012340123456,1,2"}},
{command: "d02c810301100082028183850e434f4e4649524d4154494f4e20338609911032042143651c2c850643414c4c2033",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "CONFIRMATION 3" },
callMessage: { text: "CALL 3" },
address: "+012340123456,1,2"}},
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20318609911032042143651c2c850643414c4c2031d004000e08b4d004000608b4",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "CONFIRMATION 1" },
callMessage: { text: "CALL 1" },
address: "+012340123456,1,2"}},
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20328609911032042143651c2c850643414c4c2032d004000e00b4d004000600b4",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "CONFIRMATION 2" },
callMessage: { text: "CALL 2" },
address: "+012340123456,1,2"}},
{command: "d02c810301100082028183850e434f4e4649524d4154494f4e20338609911032042143651c2c850643414c4c2033",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "CONFIRMATION 3" },
callMessage: { text: "CALL 3" },
address: "+012340123456,1,2"}},
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20318609911032042143651c2c850643414c4c2031d004000e10b4d004000610b4",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "CONFIRMATION 1" },
callMessage: { text: "CALL 1" },
address: "+012340123456,1,2"}},
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20328609911032042143651c2c850643414c4c2032d004000e00b4d004000600b4",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "CONFIRMATION 2" },
callMessage: { text: "CALL 2" },
address: "+012340123456,1,2"}},
{command: "d02c810301100082028183850e434f4e4649524d4154494f4e20338609911032042143651c2c850643414c4c2033",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "CONFIRMATION 3" },
callMessage: { text: "CALL 3" },
address: "+012340123456,1,2"}},
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20318609911032042143651c2c850643414c4c2031d004000e20b4d004000620b4",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "CONFIRMATION 1" },
callMessage: { text: "CALL 1" },
address: "+012340123456,1,2"}},
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20328609911032042143651c2c850643414c4c2032d004000e00b4d004000600b4",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "CONFIRMATION 2" },
callMessage: { text: "CALL 2" },
address: "+012340123456,1,2"}},
{command: "d02c810301100082028183850e434f4e4649524d4154494f4e20338609911032042143651c2c850643414c4c2033",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "CONFIRMATION 3" },
callMessage: { text: "CALL 3" },
address: "+012340123456,1,2"}},
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20318609911032042143651c2c850643414c4c2031d004000e40b4d004000640b4",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "CONFIRMATION 1" },
callMessage: { text: "CALL 1" },
address: "+012340123456,1,2"}},
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20328609911032042143651c2c850643414c4c2032d004000e00b4d004000600b4",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "CONFIRMATION 2" },
callMessage: { text: "CALL 2" },
address: "+012340123456,1,2"}},
{command: "d02c810301100082028183850e434f4e4649524d4154494f4e20338609911032042143651c2c850643414c4c2033",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "CONFIRMATION 3" },
callMessage: { text: "CALL 3" },
address: "+012340123456,1,2"}},
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20318609911032042143651c2c850643414c4c2031d004000e80b4d004000680b4",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "CONFIRMATION 1" },
callMessage: { text: "CALL 1" },
address: "+012340123456,1,2"}},
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20328609911032042143651c2c850643414c4c2032d004000e00b4d004000600b4",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "CONFIRMATION 2" },
callMessage: { text: "CALL 2" },
address: "+012340123456,1,2"}},
{command: "d02c810301100082028183850e434f4e4649524d4154494f4e20338609911032042143651c2c850643414c4c2033",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "CONFIRMATION 3" },
callMessage: { text: "CALL 3" },
address: "+012340123456,1,2"}},
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20318609911032042143651c2c850643414c4c2031d004000e00b4d0040006004b",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "CONFIRMATION 1" },
callMessage: { text: "CALL 1" },
address: "+012340123456,1,2"}},
{command: "d02c810301100082028183850e434f4e4649524d4154494f4e20328609911032042143651c2c850643414c4c2032",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "CONFIRMATION 2" },
callMessage: { text: "CALL 2" },
address: "+012340123456,1,2"}},
{command: "d02d810301100082028183851980041704140420041004120421042204120423041904220415860791103204214365",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "ЗДРАВСТВУЙТЕ" },
address: "+012340123456"}},
{command: "d04c810301100082028183851b800417041404200410041204210422041204230419042204150031860791103204214365851b800417041404200410041204210422041204230419042204150032",
{command: "D04C" + // Length
"8103011000" + // Command details
"82028183" + // Device identities
"851B800417041404200410041204210422041204230419042204150031" + // Alpha identifier
"860791103204214365" + // Address
"851B800417041404200410041204210422041204230419042204150032", // Alpha identifier
expect: {commandQualifier: 0x00,
confirmMessage: { text: "ЗДРАВСТВУЙТЕ1" },
callMessage: { text: "ЗДРАВСТВУЙТЕ2" },
address: "+012340123456"}},
{command: "d0198103011000820281838505804e0d5fd9860791103204214365",
{command: "D019" + // Length
"8103011000" + // Command details
"82028183" + // Device identities
"8505804E0D5FD9" + // Alpha identifier
"860791103204214365", // Address
expect: {commandQualifier: 0x00,
confirmMessage: { text: "不忙" },
address: "+012340123456"}},
{command: "d022810301100082028183850580786e5b9a860791103204214365850780625375358bdd",
{command: "D022" + // Length
"8103011000" + // Command details
"82028183" + // Device identities
"850580786E5B9A" + // Alpha identifier
"860791103204214365" + // Address
"850780625375358BDD", // Alpha identifier
expect: {commandQualifier: 0x00,
confirmMessage: { text: "确定" },
callMessage: { text: "打电话" },
address: "+012340123456"}},
{command: "d01781030110008202818385038030eb860791103204214365",
{command: "D016" + // Length
"8103011000" + // Command details
"82028183" + // Device identities
"8500" + // Alpha identifier
"860791103204214365" + // Address
"8500", // Alpha identifier
expect: {commandQualifier: 0x00,
confirmMessage: { text: "ル" },
confirmMessage: { text: "" },
callMessage: { text: "" },
address: "+012340123456"}},
{command: "d02081030110008202818385058030eb003186079110320421436585058030eb0032",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "ル1" },
callMessage: { text: "ル2" },
address: "+012340123456"}},
{command: "d029810301100482028182050a446973636f6e6e6563748609811032042143651c2c05074d657373616765",
expect: {commandQualifier: 0x04,
confirmMessage: { text: "Disconnect" },
address: "012340123456,1,2",
callMessage: { text: "Message"}}},
{command: "d02281030110008202818385084E6F7420627573798609911032042143651C2C8402010A",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "Not busy" },
address: "+012340123456,1,2",
duration: {timeUnit: MozIccManager.STK_TIME_UNIT_SECOND,
timeInterval: 0x0A}}},
{command: "d04c81030110008202818385165365742075702063616c6c2049636f6e20332e352e318609911032042143651c2c9e02000185165365742075702063616c6c2049636f6e20332e352e329e020103",
expect: {commandQualifier: 0x00,
confirmMessage: { text: "Set up call Icon 3.5.1",
iconSelfExplanatory: true,
icons: [BASIC_ICON] },
callMessage: { text: "Set up call Icon 3.5.2",
iconSelfExplanatory: false,
icons: [COLOR_ICON] },
address: "+012340123456,1,2"}},
{command: "d01c8103011000820281838609911032042143651c2c9e0200019e020103",
{command: "D01C" + // Length
"8103011000" + // Command details
"82028183" + // Device identities
"8609911032042143651C2C" + // Address
"9E020001" + // Icon identifier
"9E020103", // Icon identifier
expect: {commandQualifier: 0x00,
confirmMessage: { iconSelfExplanatory: true,
icons: [BASIC_ICON] },
@ -255,23 +182,25 @@ const TEST_DATA = [
];
function testSetupCall(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SET_UP_CALL,
"typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier,
"commandQualifier");
is(aCommand.options.address, aExpect.address,
"options.address");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
is(aCommand.options.address, aExpect.address, "options.address");
if (aExpect.confirmMessage) {
// confirmMessage is optional.
if ("confirmMessage" in aExpect) {
isStkText(aCommand.options.confirmMessage, aExpect.confirmMessage);
}
if (aExpect.callMessage) {
// callMessage is optional.
if ("callMessage" in aExpect) {
isStkText(aCommand.options.callMessage, aExpect.callMessage);
}
let duration = aCommand.options.duration;
if (duration) {
// duration is optional.
if ("duration" in aExpect) {
let duration = aCommand.options.duration;
is(duration.timeUnit, aExpect.duration.timeUnit, "duration.timeUnit");
is(duration.timeInterval, aExpect.duration.timeInterval,
"duration.timeInterval");
@ -291,6 +220,12 @@ startTestCommon(function() {
// Wait onstkcommand event.
promises.push(waitForTargetEvent(icc, "stkcommand")
.then((aEvent) => testSetupCall(aEvent.command, data.expect)));
// Wait icc-stkcommand system message.
promises.push(waitForSystemMessage("icc-stkcommand")
.then((aMessage) => {
is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
testSetupCall(aMessage.command, data.expect);
}));
// Send emulator command to generate stk unsolicited event.
promises.push(sendEmulatorStkPdu(data.command));

Просмотреть файл

@ -5,27 +5,46 @@ MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "d00c810301050082028182990104",
{command: "D00C" + // Length
"8103010500" + // Command details
"82028182" + // Device identities
"990104", // Event list
expect: {commandQualifier: 0x00,
eventList: [4]}},
{command: "d00d81030105008202818299020507",
{command: "D00D" + // Length
"8103010500" + // Command details
"82028182" + // Device identities
"99020507", // Event list
expect: {commandQualifier: 0x00,
eventList: [5, 7]}},
{command: "d00c810301050082028182990107",
{command: "D00C" + // Length
"8103010500" + // Command details
"82028182" + // Device identities
"990107", // Event list
expect: {commandQualifier: 0x00,
eventList: [7]}},
{command: "d00c810301050082028182990107",
{command: "D00C" + // Length
"8103010500" + // Command details
"82028182" + // Device identities
"990107", // Event list
expect: {commandQualifier: 0x00,
eventList: [7]}},
{command: "d00b8103010500820281829900",
{command: "D00B" + // Length
"8103010500" + // Command details
"82028182" + // Device identities
"9900", // Event list
expect: {commandQualifier: 0x00,
eventList: null}},
{command: "d00c810301050082028182990107",
{command: "D00C" + // Length
"8103010500" + // Command details
"82028182" + // Device identities
"990107", // Event list
expect: {commandQualifier: 0x00,
eventList: [7]}}
];
function testSetupEventList(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SET_UP_EVENT_LIST,
"typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
@ -49,6 +68,12 @@ startTestCommon(function() {
// Wait onstkcommand event.
promises.push(waitForTargetEvent(icc, "stkcommand")
.then((aEvent) => testSetupEventList(aEvent.command, data.expect)));
// Wait icc-stkcommand system message.
promises.push(waitForSystemMessage("icc-stkcommand")
.then((aMessage) => {
is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
testSetupEventList(aMessage.command, data.expect);
}));
// Send emulator command to generate stk unsolicited event.
promises.push(sendEmulatorStkPdu(data.command));

Просмотреть файл

@ -5,126 +5,81 @@ MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "d01a8103012800820281828d0f0449646c65204d6f64652054657874",
{command: "D01A" + // Length
"8103012800" + // Command details
"82028182" + // Device identities
"8D0F0449646C65204D6F64652054657874", // Text string
expect: {commandQualifier: 0x00,
text: "Idle Mode Text"}},
{command: "d0188103012800820281828d0d04546f6f6c6b69742054657374",
{command: "D081FD" + // Length
"8103012800" + // Command details
"82028182" + // Device identities
"8D81F100547419344D3641737498CD06CDEB70383B0F0A" + // Text string
"83E8653C1D34A7CBD3EE330B7447A7C768D01C1D66B341" +
"E232889C9EC3D9E17C990C12E741747419D42C82C27350" +
"D80D4A93D96550FB4D2E83E8653C1D943683E8E832A859" +
"04A5E7A0B0985D06D1DF20F21B94A6BBA8E832082E2FCF" +
"CB6E7A989E7EBB41737A9E5D06A5E72076D94C0785E7A0" +
"B01B946EC3D9E576D94D0FD3D36F37885C1EA7E7E9B71B" +
"447F83E8E832A85904B5C3EEBA393CA6D7E565B90B4445" +
"97416932BB0C6ABFC96510BD8CA783E6E8309B0D129741" +
"E4F41CCE0EE7CB6450DA0D0A83DA61B7BB2C07D1D1613A" +
"A8EC9ED7E5E539888E0ED341EE32",
expect: {commandQualifier: 0x00,
text: "Toolkit Test"}},
{command: "d081fd8103012800820281828d81f100547419344d3641737498cd06cdeb70383b0f0a83e8653c1d34a7cbd3ee330b7447a7c768d01c1d66b341e232889c9ec3d9e17c990c12e741747419d42c82c27350d80d4a93d96550fb4d2e83e8653c1d943683e8e832a85904a5e7a0b0985d06d1df20f21b94a6bba8e832082e2fcfcb6e7a989e7ebb41737a9e5d06a5e72076d94c0785e7a0b01b946ec3d9e576d94d0fd3d36f37885c1ea7e7e9b71b447f83e8e832a85904b5c3eeba393ca6d7e565b90b444597416932bb0c6abfc96510bd8ca783e6e8309b0d129741e4f41cce0ee7cb6450da0d0a83da61b7bb2c07d1d1613aa8ec9ed7e5e539888e0ed341ee32",
expect: {commandQualifier: 0x00,
text: "The SIM shall supply a text string, which shall be displayed by the ME as an idle mode text if the ME is able to do it.The presentation style is left as an implementation decision to the ME manufacturer. The idle mode text shall be displayed in a manner that ensures that ne"}},
{command: "d0198103012800820281828d0a0449646c6520746578749e020001",
expect: {commandQualifier: 0x00,
text: "Idle text",
iconSelfExplanatory: true,
icons: [BASIC_ICON]}},
{command: "d0198103012800820281828d0a0449646c6520746578749e020105",
text: "The SIM shall supply a text string, which shall be " +
"displayed by the ME as an idle mode text if the ME is " +
"able to do it.The presentation style is left as an " +
"implementation decision to the ME manufacturer. The idle " +
"mode text shall be displayed in a manner that ensures " +
"that ne"}},
{command: "D019" + // Length
"8103012800" + // Command details
"82028182" + // Device identities
"8D0A0449646C652074657874" + // Text string
"9E020101", // Icon identifier
expect: {commandQualifier: 0x00,
text: "Idle text",
iconSelfExplanatory: false,
icons: [COLOR_TRANSPARENCY_ICON]}},
{command: "d0198103012800820281828d0a0449646c6520746578749e020007",
icons: [BASIC_ICON]}},
{command: "D019" + // Length
"8103012800" + // Command details
"82028182" + // Device identities
"8D0A0449646C652074657874" + // Text string
"9E020007", // Icon identifier
expect: {commandQualifier: 0x00,
text: "Idle text",
iconSelfExplanatory: true,
icons: [COLOR_ICON, COLOR_TRANSPARENCY_ICON]}},
{command: "d0248103012800820281828d1908041704140420041004120421042204120423041904220415",
{command: "D024" + // Length
"8103012800" + // Command details
"82028182" + // Device identities
"8D1908041704140420041004120421042204120423041904220415", // Text string
expect: {commandQualifier: 0x00,
text: "ЗДРАВСТВУЙТЕ"}},
{command: "d0228103012800820281828d110449646c65204d6f646520546578742031d004001000b4",
{command: "D022" + // Length
"8103012800" + // Command details
"82028182" + // Device identities
"8D110449646C65204D6F646520546578742031" + // Text string
"D004001000B4", // Text attribute
expect: {commandQualifier: 0x00,
text: "Idle Mode Text 1"}},
{command: "d01c8103012800820281828d110449646c65204d6f646520546578742032",
expect: {commandQualifier: 0x00,
text: "Idle Mode Text 2"}},
{command: "d0228103012800820281828d110449646c65204d6f646520546578742031d004001001b4",
expect: {commandQualifier: 0x00,
text: "Idle Mode Text 1"}},
{command: "d01c8103012800820281828d110449646c65204d6f646520546578742032",
expect: {commandQualifier: 0x00,
text: "Idle Mode Text 2"}},
{command: "d0228103012800820281828d110449646c65204d6f646520546578742031d004001002b4",
expect: {commandQualifier: 0x00,
text: "Idle Mode Text 1"}},
{command: "d01c8103012800820281828d110449646c65204d6f646520546578742032",
expect: {commandQualifier: 0x00,
text: "Idle Mode Text 2"}},
{command: "d0228103012800820281828d110449646c65204d6f646520546578742031d004001004b4",
expect: {commandQualifier: 0x00,
text: "Idle Mode Text 1"}},
{command: "d0228103012800820281828d110449646c65204d6f646520546578742032d004001000b4",
expect: {commandQualifier: 0x00,
text: "Idle Mode Text 2"}},
{command: "d01c8103012800820281828d110449646c65204d6f646520546578742033",
expect: {commandQualifier: 0x00,
text: "Idle Mode Text 3"}},
{command: "d0228103012800820281828d110449646c65204d6f646520546578742031d004001008b4",
expect: {commandQualifier: 0x00,
text: "Idle Mode Text 1"}},
{command: "d0228103012800820281828d110449646c65204d6f646520546578742032d004001000b4",
expect: {commandQualifier: 0x00,
text: "Idle Mode Text 2"}},
{command: "d01c8103012800820281828d110449646c65204d6f646520546578742033",
expect: {commandQualifier: 0x00,
text: "Idle Mode Text 3"}},
{command: "d0228103012800820281828d110449646c65204d6f646520546578742031d004001010b4",
expect: {commandQualifier: 0x00,
text: "Idle Mode Text 1"}},
{command: "d0228103012800820281828d110449646c65204d6f646520546578742032d004001000b4",
expect: {commandQualifier: 0x00,
text: "Idle Mode Text 2"}},
{command: "d01c8103012800820281828d110449646c65204d6f646520546578742033",
expect: {commandQualifier: 0x00,
text: "Idle Mode Text 3"}},
{command: "d0228103012800820281828d110449646c65204d6f646520546578742031d004001020b4",
expect: {commandQualifier: 0x00,
text: "Idle Mode Text 1"}},
{command: "d0228103012800820281828d110449646c65204d6f646520546578742032d004001000b4",
expect: {commandQualifier: 0x00,
text: "Idle Mode Text 2"}},
{command: "d01c8103012800820281828d110449646c65204d6f646520546578742033",
expect: {commandQualifier: 0x00,
text: "Idle Mode Text 3"}},
{command: "d0228103012800820281828d110449646c65204d6f646520546578742031d004001040b4",
expect: {commandQualifier: 0x00,
text: "Idle Mode Text 1"}},
{command: "d0228103012800820281828d110449646c65204d6f646520546578742032d004001000b4",
expect: {commandQualifier: 0x00,
text: "Idle Mode Text 2"}},
{command: "d01c8103012800820281828d110449646c65204d6f646520546578742033",
expect: {commandQualifier: 0x00,
text: "Idle Mode Text 3"}},
{command: "d0228103012800820281828d110449646c65204d6f646520546578742031d004001080b4",
expect: {commandQualifier: 0x00,
text: "Idle Mode Text 1"}},
{command: "d0228103012800820281828d110449646c65204d6f646520546578742032d004001000b4",
expect: {commandQualifier: 0x00,
text: "Idle Mode Text 2"}},
{command: "d01c8103012800820281828d110449646c65204d6f646520546578742033",
expect: {commandQualifier: 0x00,
text: "Idle Mode Text 3"}},
{command: "d0228103012800820281828d110449646c65204d6f646520546578742031d004001000b4",
expect: {commandQualifier: 0x00,
text: "Idle Mode Text 1"}},
{command: "d01c8103012800820281828d110449646c65204d6f646520546578742032",
expect: {commandQualifier: 0x00,
text: "Idle Mode Text 2"}},
{command: "d0108103012800820281828d05084f60597d",
{command: "D010" + // Length
"8103012800" + // Command details
"82028182" + // Device identities
"8D05084F60597D", // Text string
expect: {commandQualifier: 0x00,
text: "你好"}},
{command: "d0148103012800820281828d09080038003030eb0030",
expect: {commandQualifier: 0x00,
text: "80ル0"}},
];
function testSetupIdleModeText(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SET_UP_IDLE_MODE_TEXT,
"typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
is(aCommand.options.text, aExpect.text, "options.text");
if (aExpect.icons) {
// icons is optional.
if ("icons" in aExpect) {
isIcons(aCommand.options.icons, aExpect.icons);
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
"options.iconSelfExplanatory");
@ -144,6 +99,12 @@ startTestCommon(function() {
// Wait onstkcommand event.
promises.push(waitForTargetEvent(icc, "stkcommand")
.then((aEvent) => testSetupIdleModeText(aEvent.command, data.expect)));
// Wait icc-stkcommand system message.
promises.push(waitForSystemMessage("icc-stkcommand")
.then((aMessage) => {
is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
testSetupIdleModeText(aMessage.command, data.expect);
}));
// Send emulator command to generate stk unsolicited event.
promises.push(sendEmulatorStkPdu(data.command));

Просмотреть файл

@ -5,44 +5,163 @@ MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
{command: "d03b810301250082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20338f07044974656d2034",
expect: {commandQualifier: 0x00,
title: "Toolkit Menu",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}, {identifier: 4, text: "Item 4"}]}},
{command: "d023810301250082028182850c546f6f6c6b6974204d656e758f04114f6e658f041254776f",
expect: {commandQualifier: 0x00,
title: "Toolkit Menu",
items: [{identifier: 17, text: "One"}, {identifier: 18, text: "Two"}]}},
{command: "d081fc810301250082028182850a4c617267654d656e75318f05505a65726f8f044f4f6e658f044e54776f8f064d54687265658f054c466f75728f054b466976658f044a5369788f0649536576656e8f064845696768748f05474e696e658f0646416c7068618f0645427261766f8f0844436861726c69658f064344656c74618f05424563686f8f0941466f782d74726f748f0640426c61636b8f063f42726f776e8f043e5265648f073d4f72616e67658f073c59656c6c6f778f063b477265656e8f053a426c75658f073956696f6c65748f0538477265798f063757686974658f06366d696c6c698f06356d6963726f8f05346e616e6f8f05337069636f",
{command: "D081FC" + // Length
"8103012500" + // Command details
"82028182" + // Device identities
"850A4C617267654D656E7531" + // Alpha identifier
"8F05505A65726F" + // Item
"8F044F4F6E65" + // Item
"8F044E54776F" + // Item
"8F064D5468726565" + // Item
"8F054C466F7572" + // Item
"8F054B46697665" + // Item
"8F044A536978" + // Item
"8F0649536576656E" + // Item
"8F06484569676874" + // Item
"8F05474E696E65" + // Item
"8F0646416C706861" + // Item
"8F0645427261766F" + // Item
"8F0844436861726C6965" + // Item
"8F064344656C7461" + // Item
"8F05424563686F" + // Item
"8F0941466F782D74726F74" + // Item
"8F0640426C61636B" + // Item
"8F063F42726F776E" + // Item
"8F043E526564" + // Item
"8F073D4F72616E6765" + // Item
"8F073C59656C6C6F77" + // Item
"8F063B477265656E" + // Item
"8F053A426C7565" + // Item
"8F073956696F6C6574" + // Item
"8F053847726579" + // Item
"8F06375768697465" + // Item
"8F06366D696C6C69" + // Item
"8F06356D6963726F" + // Item
"8F05346E616E6F" + // Item
"8F05337069636F", // Item
expect: {commandQualifier: 0x00,
title: "LargeMenu1",
items: [{identifier: 80, text: "Zero"}, {identifier: 79, text: "One"}, {identifier: 78, text: "Two"}, {identifier: 77, text: "Three"}, {identifier: 76, text: "Four"}, {identifier: 75, text: "Five"}, {identifier: 74, text: "Six"}, {identifier: 73, text: "Seven"}, {identifier: 72, text: "Eight"}, {identifier: 71, text: "Nine"}, {identifier: 70, text: "Alpha"}, {identifier: 69, text: "Bravo"}, {identifier: 68, text: "Charlie"}, {identifier: 67, text: "Delta"}, {identifier: 66, text: "Echo"}, {identifier: 65, text: "Fox-trot"}, {identifier: 64, text: "Black"}, {identifier: 63, text: "Brown"}, {identifier: 62, text: "Red"}, {identifier: 61, text: "Orange"}, {identifier: 60, text: "Yellow"}, {identifier: 59, text: "Green"}, {identifier: 58, text: "Blue"}, {identifier: 57, text: "Violet"}, {identifier: 56, text: "Grey"}, {identifier: 55, text: "White"}, {identifier: 54, text: "milli"}, {identifier: 53, text: "micro"}, {identifier: 52, text: "nano"}, {identifier: 51, text: "pico"}]}},
{command: "d081f3810301250082028182850a4c617267654d656e75328f1dff312043616c6c20466f727761726420556e636f6e646974696f6e616c8f1cfe322043616c6c20466f7277617264204f6e205573657220427573798f1bfd332043616c6c20466f7277617264204f6e204e6f205265706c798f25fc342043616c6c20466f7277617264204f6e2055736572204e6f7420526561636861626c658f20fb352042617272696e67204f6620416c6c204f7574676f696e672043616c6c738f24fa362042617272696e67204f6620416c6c204f7574676f696e6720496e742043616c6c738f13f93720434c492050726573656e746174696f6e",
items: [{identifier: 80, text: "Zero"},
{identifier: 79, text: "One"},
{identifier: 78, text: "Two"},
{identifier: 77, text: "Three"},
{identifier: 76, text: "Four"},
{identifier: 75, text: "Five"},
{identifier: 74, text: "Six"},
{identifier: 73, text: "Seven"},
{identifier: 72, text: "Eight"},
{identifier: 71, text: "Nine"},
{identifier: 70, text: "Alpha"},
{identifier: 69, text: "Bravo"},
{identifier: 68, text: "Charlie"},
{identifier: 67, text: "Delta"},
{identifier: 66, text: "Echo"},
{identifier: 65, text: "Fox-trot"},
{identifier: 64, text: "Black"},
{identifier: 63, text: "Brown"},
{identifier: 62, text: "Red"},
{identifier: 61, text: "Orange"},
{identifier: 60, text: "Yellow"},
{identifier: 59, text: "Green"},
{identifier: 58, text: "Blue"},
{identifier: 57, text: "Violet"},
{identifier: 56, text: "Grey"},
{identifier: 55, text: "White"},
{identifier: 54, text: "milli"},
{identifier: 53, text: "micro"},
{identifier: 52, text: "nano"},
{identifier: 51, text: "pico"}]}},
{command: "D081F3" + // Length
"8103012500" + // Command details
"82028182" + // Device identities
"850A4C617267654D656E7532" + // Alpha identifier
"8F1DFF312043616C6C20466F727761726420556E636F6E646974" + // Item
"696F6E616C" +
"8F1CFE322043616C6C20466F7277617264204F6E205573657220" + // Item
"42757379" +
"8F1BFD332043616C6C20466F7277617264204F6E204E6F205265" + // Item
"706C79" +
"8F25FC342043616C6C20466F7277617264204F6E205573657220" + // Item
"4E6F7420526561636861626C65" +
"8F20FB352042617272696E67204F6620416C6C204F7574676F69" + // Item
"6E672043616C6C73" +
"8F24FA362042617272696E67204F6620416C6C204F7574676F69" + // Item
"6E6720496E742043616C6C73" +
"8F13F93720434C492050726573656E746174696F6E", // Item
expect: {commandQualifier: 0x00,
title: "LargeMenu2",
items: [{identifier: 255, text: "1 Call Forward Unconditional"}, {identifier: 254, text: "2 Call Forward On User Busy"}, {identifier: 253, text: "3 Call Forward On No Reply"}, {identifier: 252, text: "4 Call Forward On User Not Reachable"}, {identifier: 251, text: "5 Barring Of All Outgoing Calls"}, {identifier: 250, text: "6 Barring Of All Outgoing Int Calls"}, {identifier: 249, text: "7 CLI Presentation"}]}},
{command: "d081fc8103012500820281828581ec5468652053494d207368616c6c20737570706c79206120736574206f66206d656e75206974656d732c207768696368207368616c6c20626520696e7465677261746564207769746820746865206d656e752073797374656d20286f72206f74686572204d4d4920666163696c6974792920696e206f7264657220746f206769766520746865207573657220746865206f70706f7274756e69747920746f2063686f6f7365206f6e65206f66207468657365206d656e75206974656d7320617420686973206f776e2064697363726574696f6e2e2045616368206974656d20636f6d70726973657320612073688f020159",
items: [{identifier: 255, text: "1 Call Forward Unconditional"},
{identifier: 254, text: "2 Call Forward On User Busy"},
{identifier: 253, text: "3 Call Forward On No Reply"},
{identifier: 252, text: "4 Call Forward On User Not Reachable"},
{identifier: 251, text: "5 Barring Of All Outgoing Calls"},
{identifier: 250, text: "6 Barring Of All Outgoing Int Calls"},
{identifier: 249, text: "7 CLI Presentation"}]}},
{command: "D081FC" + // Length
"8103012500" + // Command details
"82028182" + // Device identities
"8581EC5468652053494D207368616C6C20737570" + // Alpha identifier
"706C79206120736574206F66206D656E75206974" +
"656D732C207768696368207368616C6C20626520" +
"696E746567726174656420776974682074686520" +
"6D656E752073797374656D20286F72206F746865" +
"72204D4D4920666163696C6974792920696E206F" +
"7264657220746F20676976652074686520757365" +
"7220746865206F70706F7274756E69747920746F" +
"2063686F6F7365206F6E65206F66207468657365" +
"206D656E75206974656D7320617420686973206F" +
"776E2064697363726574696F6E2E204561636820" +
"6974656D20636F6D7072697365732061207368" +
"8F020159", // Item
expect: {commandQualifier: 0x00,
title: "The SIM shall supply a set of menu items, which shall be integrated with the menu system (or other MMI facility) in order to give the user the opportunity to choose one of these menu items at his own discretion. Each item comprises a sh",
title: "The SIM shall supply a set of menu items, which shall " +
"be integrated with the menu system (or other MMI " +
"facility) in order to give the user the opportunity to " +
"choose one of these menu items at his own discretion. " +
"Each item comprises a sh",
items: [{identifier: 1, text: "Y"}]}},
{command: "d03b810301258082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20338f07044974656d2034",
{command: "D03B" + // Length
"8103012580" + // Command details
"82028182" + // Device identities
"850C546F6F6C6B6974204D656E75" + // Alpha identifier
"8F07014974656D2031" + // Item
"8F07024974656D2032" + // Item
"8F07034974656D2033" + // Item
"8F07044974656D2034", // Item
expect: {commandQualifier: 0x80,
title: "Toolkit Menu",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}, {identifier: 4, text: "Item 4"}]}},
{command: "d041810301250082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20338f07044974656d2034180413101526",
items: [{identifier: 1, text: "Item 1"},
{identifier: 2, text: "Item 2"},
{identifier: 3, text: "Item 3"},
{identifier: 4, text: "Item 4"}]}},
{command: "D041" + // Length
"8103012500" + // Command details
"82028182" + // Device identities
"850C546F6F6C6B6974204D656E75" + // Alpha identifier
"8F07014974656D2031" + // Item
"8F07024974656D2032" + // Item
"8F07034974656D2033" + // Item
"8F07044974656D2034" + // Item
"180413101526", // Items next action indicator
expect: {commandQualifier: 0x00,
title: "Toolkit Menu",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}, {identifier: 4, text: "Item 4"}],
nextActionList: [MozIccManager.STK_CMD_SEND_SMS, MozIccManager.STK_CMD_SET_UP_CALL, MozIccManager.STK_CMD_LAUNCH_BROWSER, MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO]}},
{command: "d03c810301250082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20339e0201019f0401030303",
expect: {commandQualifier: 0x00,
title: "Toolkit Menu",
iconSelfExplanatory: false,
icons: [BASIC_ICON],
items: [{identifier: 1, text: "Item 1", iconSelfExplanatory: false, icons: [COLOR_ICON]},
{identifier: 2, text: "Item 2", iconSelfExplanatory: false, icons: [COLOR_ICON]},
{identifier: 3, text: "Item 3", iconSelfExplanatory: false, icons: [COLOR_ICON]}]}},
{command: "d03c810301250082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20339e0200019f0400050505",
items: [{identifier: 1, text: "Item 1"},
{identifier: 2, text: "Item 2"},
{identifier: 3, text: "Item 3"},
{identifier: 4, text: "Item 4"}],
nextActionList: [MozIccManager.STK_CMD_SEND_SMS,
MozIccManager.STK_CMD_SET_UP_CALL,
MozIccManager.STK_CMD_LAUNCH_BROWSER,
MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO]}},
{command: "D03C" + // Length
"8103012500" + // Command details
"82028182" + // Device identities
"850C546F6F6C6B6974204D656E75" + // Alpha identifier
"8F07014974656D2031" + // Item
"8F07024974656D2032" + // Item
"8F07034974656D2033" + // Item
"9E020001" + // Icon identifier
"9F0400050505", // Item icon identifier list
expect: {commandQualifier: 0x00,
title: "Toolkit Menu",
iconSelfExplanatory: true,
@ -50,116 +169,83 @@ const TEST_DATA = [
items: [{identifier: 1, text: "Item 1", iconSelfExplanatory: true, icons: [COLOR_TRANSPARENCY_ICON]},
{identifier: 2, text: "Item 2", iconSelfExplanatory: true, icons: [COLOR_TRANSPARENCY_ICON]},
{identifier: 3, text: "Item 3", iconSelfExplanatory: true, icons: [COLOR_TRANSPARENCY_ICON]}]}},
{command: "d029810301250182028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d2032",
expect: {commandQualifier: 0x01,
title: "Toolkit Menu",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
{command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e00b4d10c000600b4000600b4000600b4",
expect: {commandQualifier: 0x00,
title: "Toolkit Menu 1",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
{command: "d034810301250082028182850e546f6f6c6b6974204d656e7520328f07044974656d20348f07054974656d20358f07064974656d2036",
expect: {commandQualifier: 0x00,
title: "Toolkit Menu 2",
items: [{identifier: 4, text: "Item 4"}, {identifier: 5, text: "Item 5"}, {identifier: 6, text: "Item 6"}]}},
{command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e01b4d10c000601b4000601b4000601b4",
expect: {commandQualifier: 0x00,
title: "Toolkit Menu 1",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
{command: "d034810301250082028182850e546f6f6c6b6974204d656e7520328f07044974656d20348f07054974656d20358f07064974656d2036",
expect: {commandQualifier: 0x00,
title: "Toolkit Menu 2",
items: [{identifier: 4, text: "Item 4"}, {identifier: 5, text: "Item 5"}, {identifier: 6, text: "Item 6"}]}},
{command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e02b4d10c000602b4000602b4000602b4",
expect: {commandQualifier: 0x00,
title: "Toolkit Menu 1",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
{command: "d034810301250082028182850e546f6f6c6b6974204d656e7520328f07044974656d20348f07054974656d20358f07064974656d2036",
expect: {commandQualifier: 0x00,
title: "Toolkit Menu 2",
items: [{identifier: 4, text: "Item 4"}, {identifier: 5, text: "Item 5"}, {identifier: 6, text: "Item 6"}]}},
{command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e04b4d10c000604b4000604b4000604b4",
expect: {commandQualifier: 0x00,
title: "Toolkit Menu 1",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
{command: "d048810301250082028182850e546f6f6c6b6974204d656e7520328f07044974656d20348f07054974656d20358f07064974656d2036d004000e00b4d10c000600b4000600b4000600b4",
expect: {commandQualifier: 0x00,
title: "Toolkit Menu 2",
items: [{identifier: 4, text: "Item 4"}, {identifier: 5, text: "Item 5"}, {identifier: 6, text: "Item 6"}]}},
{command: "d034810301250082028182850e546f6f6c6b6974204d656e7520338f07074974656d20378f07084974656d20388f07094974656d2039",
expect: {commandQualifier: 0x00,
title: "Toolkit Menu 3",
items: [{identifier: 7, text: "Item 7"}, {identifier: 8, text: "Item 8"}, {identifier: 9, text: "Item 9"}]}},
{command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e08b4d10c000608b4000608b4000608b4",
expect: {commandQualifier: 0x00,
title: "Toolkit Menu 1",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
{command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e10b4d10c000610b4000610b4000610b4",
expect: {commandQualifier: 0x00,
title: "Toolkit Menu 1",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
{command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e20b4d10c000620b4000620b4000620b4",
expect: {commandQualifier: 0x00,
title: "Toolkit Menu 1",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
{command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e40b4d10c000640b4000640b4000640b4",
expect: {commandQualifier: 0x00,
title: "Toolkit Menu 1",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
{command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e80b4d10c000680b4000680b4000680b4",
expect: {commandQualifier: 0x00,
title: "Toolkit Menu 1",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
{command: "d046810301250082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d2033d004000c00b4d10c000600b4000600b4000600b4",
{command: "D036" + // Length
"8103012500" + // Command details
"82028182" + // Device identities
"850C546F6F6C6B6974204D656E75" + // Alpha identifier
"8F07014974656D2031" + // Item
"8F07024974656D2032" + // Item
"8F07034974656D2033" + // Item
"9E020001", // Icon identifier
expect: {commandQualifier: 0x00,
title: "Toolkit Menu",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
{command: "d0819c8103012500820281828519800417041404200410041204210422041204230419042204158f1c018004170414042004100412042104220412042304190422041500318f1c028004170414042004100412042104220412042304190422041500328f1c038004170414042004100412042104220412042304190422041500338f1c04800417041404200410041204210422041204230419042204150034",
iconSelfExplanatory: true,
icons: [BASIC_ICON],
items: [{identifier: 1, text: "Item 1"},
{identifier: 2, text: "Item 2"},
{identifier: 3, text: "Item 3"}]}},
{command: "D038" + // Length
"8103012500" + // Command details
"82028182" + // Device identities
"850C546F6F6C6B6974204D656E75" + // Alpha identifier
"8F07014974656D2031" + // Item
"8F07024974656D2032" + // Item
"8F07034974656D2033" + // Item
"9F0400030303", // Item icon identifier list
expect: {commandQualifier: 0x00,
title: "Toolkit Menu",
items: [{identifier: 1, text: "Item 1", iconSelfExplanatory: true, icons: [COLOR_ICON]},
{identifier: 2, text: "Item 2", iconSelfExplanatory: true, icons: [COLOR_ICON]},
{identifier: 3, text: "Item 3", iconSelfExplanatory: true, icons: [COLOR_ICON]}]}},
{command: "D0819C" + // Length
"8103012500" + // Command details
"82028182" + // Device identities
"851980041704140420041004120421042204120423041904220415" + // Alpha identifier
"8F1C01800417041404200410041204210422041204230419042204150031" + // Item
"8F1C02800417041404200410041204210422041204230419042204150032" + // Item
"8F1C03800417041404200410041204210422041204230419042204150033" + // Item
"8F1C04800417041404200410041204210422041204230419042204150034", // Item
expect: {commandQualifier: 0x00,
title: "ЗДРАВСТВУЙТЕ",
items: [{identifier: 1, text: "ЗДРАВСТВУЙТЕ1"}, {identifier: 2, text: "ЗДРАВСТВУЙТЕ2"}, {identifier: 3, text: "ЗДРАВСТВУЙТЕ3"}, {identifier: 4, text: "ЗДРАВСТВУЙТЕ4"}]}},
{command: "d0608103012500820281828519800417041404200410041204210422041204230419042204158f1c118004170414042004100412042104220412042304190422041500358f1c12800417041404200410041204210422041204230419042204150036",
expect: {commandQualifier: 0x00,
title: "ЗДРАВСТВУЙТЕ",
items: [{identifier: 17, text: "ЗДРАВСТВУЙТЕ5"}, {identifier: 18, text: "ЗДРАВСТВУЙТЕ6"}]}},
{command: "d03c8103012500820281828509805de551777bb153558f080180987976ee4e008f080280987976ee4e8c8f080380987976ee4e098f080480987976ee56db",
items: [{identifier: 1, text: "ЗДРАВСТВУЙТЕ1"},
{identifier: 2, text: "ЗДРАВСТВУЙТЕ2"},
{identifier: 3, text: "ЗДРАВСТВУЙТЕ3"},
{identifier: 4, text: "ЗДРАВСТВУЙТЕ4"}]}},
{command: "D03C" + // Length
"8103012500" + // Command details
"82028182" + // Device identities
"8509805DE551777BB15355" + // Alpha identifier
"8F080180987976EE4E00" + // Item
"8F080280987976EE4E8C" + // Item
"8F080380987976EE4E09" + // Item
"8F080480987976EE56DB", // Item
expect: {commandQualifier: 0x00,
title: "工具箱单",
items: [{identifier: 1, text: "项目一"}, {identifier: 2, text: "项目二"}, {identifier: 3, text: "项目三"}, {identifier: 4, text: "项目四"}]}},
{command: "d0208103012500820281828509805de551777bb153558f0411804e008f0412804e8c",
expect: {commandQualifier: 0x00,
title: "工具箱单",
items: [{identifier: 17, text: "一"}, {identifier: 18, text: "二"}]}},
{command: "d0448103012500820281828509800038003030eb00308f0a01800038003030eb00318f0a02800038003030eb00328f0a03800038003030eb00338f0a04800038003030eb0034",
expect: {commandQualifier: 0x00,
title: "80ル0",
items: [{identifier: 1, text: "80ル1"}, {identifier: 2, text: "80ル2"}, {identifier: 3, text: "80ル3"}, {identifier: 4, text: "80ル4"}]}},
{command: "d02c8103012500820281828509800038003030eb00308f0a11800038003030eb00358f0a12800038003030eb0036",
expect: {commandQualifier: 0x00,
title: "80ル0",
items: [{identifier: 17, text: "80ル5"}, {identifier: 18, text: "80ル6"}]}},
{command: "d041810301250082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20338f07044974656d2034180481000000",
expect: {commandQualifier: 0x00,
title: "Toolkit Menu",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}, {identifier: 4, text: "Item 4"}],
nextActionList: [MozIccManager.STK_NEXT_ACTION_END_PROACTIVE_SESSION, MozIccManager.STK_NEXT_ACTION_NULL, MozIccManager.STK_NEXT_ACTION_NULL, MozIccManager.STK_NEXT_ACTION_NULL]}},
{command:"D03B810301250082028182850C546F6F6C6B6974204D656E758F07014974656D20318F07024974656D20328F07034974656D20338F07044974656D2034",
expect: {commandQualifier: 0x00,
title: "Toolkit Menu",
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}, {identifier: 4, text: "Item 4"}]}},
items: [{identifier: 1, text: "项目一"},
{identifier: 2, text: "项目二"},
{identifier: 3, text: "项目三"},
{identifier: 4, text: "项目四"}]}},
// Test remove setup menu.
{command: "D00D81030125008202818285008F00",
{command: "D00D" + // Length
"8103012500" + // Command details
"82028182" + // Device identities
"8500" + // Alpha identifier
"8F00", // Item
expect: {commandQualifier: 0x00,
title: "",
items: [null]}},
];
function testSetupMenu(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SET_UP_MENU, "typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
is(aCommand.options.title, aExpect.title, "options.title");
// To ensure that 'presentationType' will only be available in SELECT_ITEM.
is(aCommand.options.presentationType, undefined, "presentationType");
is(aCommand.options.isHelpAvailable, !!(aCommand.commandQualifier & 0x80),
"isHelpAvailable");
is(aCommand.options.title, aExpect.title, "options.title");
for (let index in aExpect.items) {
let item = aCommand.options.items[index];
@ -181,13 +267,15 @@ function testSetupMenu(aCommand, aExpect) {
}
}
if (aExpect.icons) {
// icons is optional.
if ("icons" in aExpect) {
isIcons(aCommand.options.icons, aExpect.icons);
is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
"options.iconSelfExplanatory");
}
if (aExpect.nextActionList) {
// nextActionList is optional.
if ("nextActionList" in aExpect) {
for (let index in aExpect.nextActionList) {
is(aCommand.options.nextActionList[index], aExpect.nextActionList[index],
"options.nextActionList[" + index + "]");
@ -208,6 +296,12 @@ startTestCommon(function() {
// Wait onstkcommand event.
promises.push(waitForTargetEvent(icc, "stkcommand")
.then((aEvent) => testSetupMenu(aEvent.command, data.expect)));
// Wait icc-stkcommand system message.
promises.push(waitForSystemMessage("icc-stkcommand")
.then((aMessage) => {
is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
testSetupMenu(aMessage.command, data.expect);
}));
// Send emulator command to generate stk unsolicited event.
promises.push(sendEmulatorStkPdu(data.command));

Просмотреть файл

@ -6,34 +6,43 @@ MARIONETTE_HEAD_JS = "head.js";
const TEST_DATA = [
// Start
{command: "d011810301270082028182a40101a503102030",
expect: {commandNumber: 0x01,
commandQualifier: MozIccManager.STK_TIMER_START,
{command: "D011" + // Length
"8103012700" + // Command details
"82028182" + // Device identities
"A40101" + // Timer identifier
"A503102030", // Timer value
expect: {commandQualifier: MozIccManager.STK_TIMER_START,
timerAction: MozIccManager.STK_TIMER_START,
timerId: 0x01,
timerValue: (0x01 * 60 * 60) + (0x02 * 60) + 0x03}},
// Deactivate
{command: "d00c810301270182028182a40104",
expect: {commandNumber: 0x01,
commandQualifier: MozIccManager.STK_TIMER_DEACTIVATE,
{command: "D00C" + // Length
"8103012701" + // Command details
"82028182" + // Device identities
"A40104", // Timer identifier
expect: {commandQualifier: MozIccManager.STK_TIMER_DEACTIVATE,
timerAction: MozIccManager.STK_TIMER_DEACTIVATE,
timerId: 0x04}},
// Get current value
{command: "d00c810301270282028182a40108",
expect: {commandNumber: 0x01,
commandQualifier: MozIccManager.STK_TIMER_GET_CURRENT_VALUE,
{command: "D00C" + // Length
"8103012702" + // Command details
"82028182" + // Device identities
"A40108", // Timer identifier
expect: {commandQualifier: MozIccManager.STK_TIMER_GET_CURRENT_VALUE,
timerAction: MozIccManager.STK_TIMER_GET_CURRENT_VALUE,
timerId: 0x08}},
];
function testTimerManagement(aCommand, aExpect) {
is(aCommand.commandNumber, 0x01, "commandNumber");
is(aCommand.typeOfCommand, MozIccManager.STK_CMD_TIMER_MANAGEMENT,
"typeOfCommand");
is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
is(aCommand.options.timerAction, aExpect.timerAction, "options.timerAction");
is(aCommand.options.timerId, aExpect.timerId, "options.timerId");
if (aExpect.timerValue) {
if ("timerValue" in aExpect) {
is(aCommand.options.timerValue, aExpect.timerValue, "options.timerValue");
}
}
@ -51,6 +60,12 @@ startTestCommon(function() {
// Wait onstkcommand event.
promises.push(waitForTargetEvent(icc, "stkcommand")
.then((aEvent) => testTimerManagement(aEvent.command, data.expect)));
// Wait icc-stkcommand system message.
promises.push(waitForSystemMessage("icc-stkcommand")
.then((aMessage) => {
is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
testTimerManagement(aMessage.command, data.expect);
}));
// Send emulator command to generate stk unsolicited event.
promises.push(sendEmulatorStkPdu(data.command));

Просмотреть файл

@ -48,11 +48,12 @@ parent:
child:
/**
* Sent from chrome when the chrome side widget is getting torn down.
* @param aParentInitiated - indicates if the shutdown is associated
* with a tab closure vs. content reload.
* Sent from content when a plugin is unloaded via layout. We shut down
* some things in response to this so that we don't end up firing async
* msgs after the child is destroyed. We know that after this call
* the child actor may not be on the other side.
*/
async ParentShutdown(bool aParentInitiated);
async ParentShutdown();
/**
* Requests a full update of the plugin window.

Просмотреть файл

@ -65,9 +65,6 @@ public:
// Can be called on any thread.
virtual void NotifyDecodedFrames(uint32_t aParsed, uint32_t aDecoded) = 0;
// For decoders with a notion of timestamp offset, returns the value in microseconds.
virtual int64_t GetTimestampOffset() const { return 0; }
// Return the duration of the media in microseconds.
virtual int64_t GetMediaDuration() = 0;

Просмотреть файл

@ -612,6 +612,8 @@ AudioCallbackDriver::Init()
mNextDriver->SetGraphTime(this, mIterationStart, mIterationEnd,
mStateComputedTime, mNextStateComputedTime);
mGraphImpl->SetCurrentDriver(mNextDriver);
DebugOnly<bool> found = mGraphImpl->RemoveMixerCallback(this);
NS_WARN_IF_FALSE(!found, "Mixer callback not added when switching?");
mNextDriver->Start();
return;
}

Просмотреть файл

@ -48,6 +48,27 @@ AudioData::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
return size;
}
/* static */
already_AddRefed<AudioData>
AudioData::TransferAndUpdateTimestampAndDuration(AudioData* aOther,
int64_t aTimestamp,
int64_t aDuration)
{
NS_ENSURE_TRUE(aOther, nullptr);
nsRefPtr<AudioData> v = new AudioData(aOther->mOffset,
aTimestamp,
aDuration,
aOther->mFrames,
aOther->mAudioData,
aOther->mChannels,
aOther->mRate);
v->mDiscontinuity = aOther->mDiscontinuity;
// Remove aOther's AudioData as it can't be shared across two targets.
aOther->mAudioData.forget();
return v.forget();
}
static bool
ValidatePlane(const VideoData::YCbCrBuffer::Plane& aPlane)
{
@ -137,6 +158,7 @@ VideoData::ShallowCopyUpdateDuration(VideoData* aOther,
aOther->mKeyframe,
aOther->mTimecode,
aOther->mDisplay);
v->mDiscontinuity = aOther->mDiscontinuity;
v->mImage = aOther->mImage;
return v.forget();
}
@ -153,6 +175,7 @@ VideoData::ShallowCopyUpdateTimestamp(VideoData* aOther,
aOther->mKeyframe,
aOther->mTimecode,
aOther->mDisplay);
v->mDiscontinuity = aOther->mDiscontinuity;
v->mImage = aOther->mImage;
return v.forget();
}
@ -170,6 +193,7 @@ VideoData::ShallowCopyUpdateTimestampAndDuration(VideoData* aOther,
aOther->mKeyframe,
aOther->mTimecode,
aOther->mDisplay);
v->mDiscontinuity = aOther->mDiscontinuity;
v->mImage = aOther->mImage;
return v.forget();
}

Просмотреть файл

@ -84,6 +84,15 @@ public:
, mRate(aRate)
, mAudioData(aData) {}
// Creates a new VideoData identical to aOther, but with a different
// specified timestamp and duration. All data from aOther is copied
// into the new AudioData but the audio data which is transferred.
// After such call, the original aOther is unusable.
static already_AddRefed<AudioData>
TransferAndUpdateTimestampAndDuration(AudioData* aOther,
int64_t aTimestamp,
int64_t aDuration);
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const;
// If mAudioBuffer is null, creates it from mAudioData.

Просмотреть файл

@ -177,7 +177,7 @@ MediaDecoderReader::ComputeStartTime(const VideoData* aVideo, const AudioData* a
}
DECODER_LOG("ComputeStartTime first video frame start %lld", aVideo ? aVideo->mTime : -1);
DECODER_LOG("ComputeStartTime first audio frame start %lld", aAudio ? aAudio->mTime : -1);
MOZ_ASSERT(startTime >= 0);
NS_ASSERTION(startTime >= 0, "Start time is negative");
return startTime;
}

Просмотреть файл

@ -430,6 +430,11 @@ public:
return mDriver;
}
bool RemoveMixerCallback(MixerCallbackReceiver* aReceiver)
{
return mMixer.RemoveCallback(aReceiver);
}
/**
* Effectively set the new driver, while we are switching.
* It is only safe to call this at the very end of an iteration, when there

Просмотреть файл

@ -206,7 +206,6 @@ MP4Reader::Init(MediaDecoderReader* aCloneDonor)
MOZ_ASSERT(NS_IsMainThread(), "Must be on main thread.");
PlatformDecoderModule::Init();
mStream = new MP4Stream(mDecoder->GetResource());
mTimestampOffset = GetDecoder()->GetTimestampOffset();
InitLayersBackendType();
@ -342,7 +341,7 @@ MP4Reader::PreReadMetadata()
bool
MP4Reader::InitDemuxer()
{
mDemuxer = new MP4Demuxer(mStream, mTimestampOffset, &mDemuxerMonitor);
mDemuxer = new MP4Demuxer(mStream, &mDemuxerMonitor);
return mDemuxer->Init();
}

Просмотреть файл

@ -127,7 +127,6 @@ private:
size_t SizeOfQueue(TrackType aTrack);
nsRefPtr<MP4Stream> mStream;
int64_t mTimestampOffset;
nsAutoPtr<mp4_demuxer::MP4Demuxer> mDemuxer;
nsRefPtr<PlatformDecoderModule> mPlatform;

Просмотреть файл

@ -24,7 +24,7 @@ public:
explicit MP4DemuxerBinding(const char* aFileName = "dash_dashinit.mp4")
: resource(new MockMediaResource(aFileName))
, mMonitor("TestMP4Demuxer monitor")
, demuxer(new MP4Demuxer(new MP4Stream(resource), 0, &mMonitor))
, demuxer(new MP4Demuxer(new MP4Stream(resource), &mMonitor))
{
EXPECT_EQ(NS_OK, resource->Open(nullptr));
}

Просмотреть файл

@ -285,7 +285,7 @@ public:
// consumers of ParseStartAndEndTimestamps to add their timestamp offset
// manually. This allows the ContainerParser to be shared across different
// timestampOffsets.
mParser = new mp4_demuxer::MoofParser(mStream, 0, 0, &mMonitor);
mParser = new mp4_demuxer::MoofParser(mStream, 0, &mMonitor);
mInitData = new LargeDataBuffer();
} else if (!mStream || !mParser) {
return false;

Просмотреть файл

@ -54,6 +54,8 @@ MediaSourceReader::MediaSourceReader(MediaSourceDecoder* aDecoder)
, mTimeThreshold(0)
, mDropAudioBeforeThreshold(false)
, mDropVideoBeforeThreshold(false)
, mAudioDiscontinuity(false)
, mVideoDiscontinuity(false)
, mEnded(false)
, mMediaSourceDuration(0)
, mHasEssentialTrackBuffers(false)
@ -91,21 +93,21 @@ MediaSourceReader::IsWaitingMediaResources()
size_t
MediaSourceReader::SizeOfVideoQueueInFrames()
{
if (!mVideoReader) {
if (!GetVideoReader()) {
MSE_DEBUG("MediaSourceReader(%p)::SizeOfVideoQueue called with no video reader", this);
return 0;
}
return mVideoReader->SizeOfVideoQueueInFrames();
return GetVideoReader()->SizeOfVideoQueueInFrames();
}
size_t
MediaSourceReader::SizeOfAudioQueueInFrames()
{
if (!mAudioReader) {
if (!GetAudioReader()) {
MSE_DEBUG("MediaSourceReader(%p)::SizeOfAudioQueue called with no audio reader", this);
return 0;
}
return mAudioReader->SizeOfAudioQueueInFrames();
return GetAudioReader()->SizeOfAudioQueueInFrames();
}
nsRefPtr<MediaDecoderReader::AudioDataPromise>
@ -113,7 +115,7 @@ MediaSourceReader::RequestAudioData()
{
nsRefPtr<AudioDataPromise> p = mAudioPromise.Ensure(__func__);
MSE_DEBUGV("MediaSourceReader(%p)::RequestAudioData", this);
if (!mAudioReader) {
if (!GetAudioReader()) {
MSE_DEBUG("MediaSourceReader(%p)::RequestAudioData called with no audio reader", this);
mAudioPromise.Reject(DECODE_ERROR, __func__);
return p;
@ -125,15 +127,15 @@ MediaSourceReader::RequestAudioData()
}
MOZ_DIAGNOSTIC_ASSERT(!mAudioSeekRequest.Exists());
SwitchReaderResult ret = SwitchAudioReader(mLastAudioTime);
SwitchSourceResult ret = SwitchAudioSource(&mLastAudioTime);
switch (ret) {
case READER_NEW:
mAudioSeekRequest.Begin(mAudioReader->Seek(mLastAudioTime, 0)
case SOURCE_NEW:
mAudioSeekRequest.Begin(GetAudioReader()->Seek(GetReaderAudioTime(mLastAudioTime), 0)
->RefableThen(GetTaskQueue(), __func__, this,
&MediaSourceReader::CompleteAudioSeekAndDoRequest,
&MediaSourceReader::CompleteAudioSeekAndRejectPromise));
break;
case READER_ERROR:
case SOURCE_ERROR:
if (mLastAudioTime) {
CheckForWaitOrEndOfStream(MediaData::AUDIO_DATA, mLastAudioTime);
break;
@ -148,7 +150,7 @@ MediaSourceReader::RequestAudioData()
void MediaSourceReader::DoAudioRequest()
{
mAudioRequest.Begin(mAudioReader->RequestAudioData()
mAudioRequest.Begin(GetAudioReader()->RequestAudioData()
->RefableThen(GetTaskQueue(), __func__, this,
&MediaSourceReader::OnAudioDecoded,
&MediaSourceReader::OnAudioNotDecoded));
@ -160,13 +162,18 @@ MediaSourceReader::OnAudioDecoded(AudioData* aSample)
MOZ_DIAGNOSTIC_ASSERT(!IsSeeking());
mAudioRequest.Complete();
int64_t ourTime = aSample->mTime + mAudioSourceDecoder->GetTimestampOffset();
if (aSample->mDiscontinuity) {
mAudioDiscontinuity = true;
}
MSE_DEBUGV("MediaSourceReader(%p)::OnAudioDecoded [mTime=%lld mDuration=%lld mDiscontinuity=%d]",
this, aSample->mTime, aSample->mDuration, aSample->mDiscontinuity);
this, ourTime, aSample->mDuration, aSample->mDiscontinuity);
if (mDropAudioBeforeThreshold) {
if (aSample->mTime < mTimeThreshold) {
if (ourTime < mTimeThreshold) {
MSE_DEBUG("MediaSourceReader(%p)::OnAudioDecoded mTime=%lld < mTimeThreshold=%lld",
this, aSample->mTime, mTimeThreshold);
mAudioRequest.Begin(mAudioReader->RequestAudioData()
this, ourTime, mTimeThreshold);
mAudioRequest.Begin(GetAudioReader()->RequestAudioData()
->RefableThen(GetTaskQueue(), __func__, this,
&MediaSourceReader::OnAudioDecoded,
&MediaSourceReader::OnAudioNotDecoded));
@ -175,9 +182,18 @@ MediaSourceReader::OnAudioDecoded(AudioData* aSample)
mDropAudioBeforeThreshold = false;
}
mLastAudioTime = aSample->mTime + aSample->mDuration;
// Adjust the sample time into our reference.
nsRefPtr<AudioData> newSample =
AudioData::TransferAndUpdateTimestampAndDuration(aSample,
ourTime,
aSample->mDuration);
mLastAudioTime = newSample->GetEndTime();
if (mAudioDiscontinuity) {
newSample->mDiscontinuity = true;
mAudioDiscontinuity = false;
}
mAudioPromise.Resolve(aSample, __func__);
mAudioPromise.Resolve(newSample, __func__);
}
// Find the closest approximation to the end time for this stream.
@ -193,11 +209,11 @@ MediaSourceReader::OnAudioDecoded(AudioData* aSample)
// quite different. By using the EOS_FUZZ_US and the buffered end time we
// attempt to account for this difference.
static void
AdjustEndTime(int64_t* aEndTime, MediaDecoderReader* aReader)
AdjustEndTime(int64_t* aEndTime, SourceBufferDecoder* aDecoder)
{
if (aReader) {
if (aDecoder) {
nsRefPtr<dom::TimeRanges> ranges = new dom::TimeRanges();
aReader->GetBuffered(ranges);
aDecoder->GetBuffered(ranges);
if (ranges->Length() > 0) {
// End time is a double so we convert to nearest by adding 0.5.
int64_t end = ranges->GetEndTime() * USECS_PER_S + 0.5;
@ -221,13 +237,13 @@ MediaSourceReader::OnAudioNotDecoded(NotDecodedReason aReason)
// End of stream. Force switching past this stream to another reader by
// switching to the end of the buffered range.
MOZ_ASSERT(aReason == END_OF_STREAM);
if (mAudioReader) {
AdjustEndTime(&mLastAudioTime, mAudioReader);
if (mAudioSourceDecoder) {
AdjustEndTime(&mLastAudioTime, mAudioSourceDecoder);
}
// See if we can find a different reader that can pick up where we left off.
if (SwitchAudioReader(mLastAudioTime) == READER_NEW) {
mAudioSeekRequest.Begin(mAudioReader->Seek(mLastAudioTime, 0)
// See if we can find a different source that can pick up where we left off.
if (SwitchAudioSource(&mLastAudioTime) == SOURCE_NEW) {
mAudioSeekRequest.Begin(GetAudioReader()->Seek(GetReaderAudioTime(mLastAudioTime), 0)
->RefableThen(GetTaskQueue(), __func__, this,
&MediaSourceReader::CompleteAudioSeekAndDoRequest,
&MediaSourceReader::CompleteAudioSeekAndRejectPromise));
@ -237,14 +253,13 @@ MediaSourceReader::OnAudioNotDecoded(NotDecodedReason aReason)
CheckForWaitOrEndOfStream(MediaData::AUDIO_DATA, mLastAudioTime);
}
nsRefPtr<MediaDecoderReader::VideoDataPromise>
MediaSourceReader::RequestVideoData(bool aSkipToNextKeyframe, int64_t aTimeThreshold)
{
nsRefPtr<VideoDataPromise> p = mVideoPromise.Ensure(__func__);
MSE_DEBUGV("MediaSourceReader(%p)::RequestVideoData(%d, %lld)",
this, aSkipToNextKeyframe, aTimeThreshold);
if (!mVideoReader) {
if (!GetVideoReader()) {
MSE_DEBUG("MediaSourceReader(%p)::RequestVideoData called with no video reader", this);
mVideoPromise.Reject(DECODE_ERROR, __func__);
return p;
@ -261,15 +276,15 @@ MediaSourceReader::RequestVideoData(bool aSkipToNextKeyframe, int64_t aTimeThres
}
MOZ_DIAGNOSTIC_ASSERT(!mVideoSeekRequest.Exists());
SwitchReaderResult ret = SwitchVideoReader(mLastVideoTime);
SwitchSourceResult ret = SwitchVideoSource(&mLastVideoTime);
switch (ret) {
case READER_NEW:
mVideoSeekRequest.Begin(mVideoReader->Seek(mLastVideoTime, 0)
case SOURCE_NEW:
mVideoSeekRequest.Begin(GetVideoReader()->Seek(GetReaderVideoTime(mLastVideoTime), 0)
->RefableThen(GetTaskQueue(), __func__, this,
&MediaSourceReader::CompleteVideoSeekAndDoRequest,
&MediaSourceReader::CompleteVideoSeekAndRejectPromise));
break;
case READER_ERROR:
case SOURCE_ERROR:
if (mLastVideoTime) {
CheckForWaitOrEndOfStream(MediaData::VIDEO_DATA, mLastVideoTime);
break;
@ -286,7 +301,7 @@ MediaSourceReader::RequestVideoData(bool aSkipToNextKeyframe, int64_t aTimeThres
void
MediaSourceReader::DoVideoRequest()
{
mVideoRequest.Begin(mVideoReader->RequestVideoData(mDropVideoBeforeThreshold, mTimeThreshold)
mVideoRequest.Begin(GetVideoReader()->RequestVideoData(mDropVideoBeforeThreshold, GetReaderVideoTime(mTimeThreshold))
->RefableThen(GetTaskQueue(), __func__, this,
&MediaSourceReader::OnVideoDecoded,
&MediaSourceReader::OnVideoNotDecoded));
@ -298,12 +313,18 @@ MediaSourceReader::OnVideoDecoded(VideoData* aSample)
MOZ_DIAGNOSTIC_ASSERT(!IsSeeking());
mVideoRequest.Complete();
// Adjust the sample time into our reference.
int64_t ourTime = aSample->mTime + mVideoSourceDecoder->GetTimestampOffset();
if (aSample->mDiscontinuity) {
mVideoDiscontinuity = true;
}
MSE_DEBUGV("MediaSourceReader(%p)::OnVideoDecoded [mTime=%lld mDuration=%lld mDiscontinuity=%d]",
this, aSample->mTime, aSample->mDuration, aSample->mDiscontinuity);
this, ourTime, aSample->mDuration, aSample->mDiscontinuity);
if (mDropVideoBeforeThreshold) {
if (aSample->mTime < mTimeThreshold) {
if (ourTime < mTimeThreshold) {
MSE_DEBUG("MediaSourceReader(%p)::OnVideoDecoded mTime=%lld < mTimeThreshold=%lld",
this, aSample->mTime, mTimeThreshold);
this, ourTime, mTimeThreshold);
DoVideoRequest();
return;
}
@ -311,9 +332,19 @@ MediaSourceReader::OnVideoDecoded(VideoData* aSample)
mTimeThreshold = 0;
}
mLastVideoTime = aSample->mTime + aSample->mDuration;
// Adjust the sample time into our reference.
nsRefPtr<VideoData> newSample =
VideoData::ShallowCopyUpdateTimestampAndDuration(aSample,
ourTime,
aSample->mDuration);
mVideoPromise.Resolve(aSample, __func__);
mLastVideoTime = newSample->GetEndTime();
if (mVideoDiscontinuity) {
newSample->mDiscontinuity = true;
mVideoDiscontinuity = false;
}
mVideoPromise.Resolve(newSample, __func__);
}
void
@ -331,13 +362,13 @@ MediaSourceReader::OnVideoNotDecoded(NotDecodedReason aReason)
// End of stream. Force switching past this stream to another reader by
// switching to the end of the buffered range.
MOZ_ASSERT(aReason == END_OF_STREAM);
if (mVideoReader) {
AdjustEndTime(&mLastVideoTime, mVideoReader);
if (mVideoSourceDecoder) {
AdjustEndTime(&mLastVideoTime, mVideoSourceDecoder);
}
// See if we can find a different reader that can pick up where we left off.
if (SwitchVideoReader(mLastVideoTime) == READER_NEW) {
mVideoSeekRequest.Begin(mVideoReader->Seek(mLastVideoTime, 0)
if (SwitchVideoSource(&mLastVideoTime) == SOURCE_NEW) {
mVideoSeekRequest.Begin(GetVideoReader()->Seek(GetReaderVideoTime(mLastVideoTime), 0)
->RefableThen(GetTaskQueue(), __func__, this,
&MediaSourceReader::CompleteVideoSeekAndDoRequest,
&MediaSourceReader::CompleteVideoSeekAndRejectPromise));
@ -395,9 +426,9 @@ MediaSourceReader::ContinueShutdown()
}
mAudioTrack = nullptr;
mAudioReader = nullptr;
mAudioSourceDecoder = nullptr;
mVideoTrack = nullptr;
mVideoReader = nullptr;
mVideoSourceDecoder = nullptr;
#ifdef MOZ_FMP4
if (mSharedDecoderManager) {
@ -422,9 +453,9 @@ MediaSourceReader::BreakCycles()
// These were cleared in Shutdown().
MOZ_ASSERT(!mAudioTrack);
MOZ_ASSERT(!mAudioReader);
MOZ_ASSERT(!mAudioSourceDecoder);
MOZ_ASSERT(!mVideoTrack);
MOZ_ASSERT(!mVideoReader);
MOZ_ASSERT(!mVideoSourceDecoder);
MOZ_ASSERT(!mTrackBuffers.Length());
for (uint32_t i = 0; i < mShutdownTrackBuffers.Length(); ++i) {
@ -433,28 +464,28 @@ MediaSourceReader::BreakCycles()
mShutdownTrackBuffers.Clear();
}
already_AddRefed<MediaDecoderReader>
MediaSourceReader::SelectReader(int64_t aTarget,
int64_t aTolerance,
const nsTArray<nsRefPtr<SourceBufferDecoder>>& aTrackDecoders)
already_AddRefed<SourceBufferDecoder>
MediaSourceReader::SelectDecoder(int64_t aTarget,
int64_t aTolerance,
const nsTArray<nsRefPtr<SourceBufferDecoder>>& aTrackDecoders)
{
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
// Consider decoders in order of newest to oldest, as a newer decoder
// providing a given buffered range is expected to replace an older one.
for (int32_t i = aTrackDecoders.Length() - 1; i >= 0; --i) {
nsRefPtr<MediaDecoderReader> newReader = aTrackDecoders[i]->GetReader();
nsRefPtr<SourceBufferDecoder> newDecoder = aTrackDecoders[i];
nsRefPtr<dom::TimeRanges> ranges = new dom::TimeRanges();
aTrackDecoders[i]->GetBuffered(ranges);
newDecoder->GetBuffered(ranges);
if (ranges->Find(double(aTarget) / USECS_PER_S,
double(aTolerance) / USECS_PER_S) == dom::TimeRanges::NoIndex) {
MSE_DEBUGV("MediaSourceReader(%p)::SelectReader(%lld) newReader=%p target not in ranges=%s",
this, aTarget, newReader.get(), DumpTimeRanges(ranges).get());
MSE_DEBUGV("MediaSourceReader(%p)::SelectDecoder(%lld) newDecoder=%p target not in ranges=%s",
this, aTarget, newDecoder.get(), DumpTimeRanges(ranges).get());
continue;
}
return newReader.forget();
return newDecoder.forget();
}
return nullptr;
@ -465,66 +496,96 @@ MediaSourceReader::HaveData(int64_t aTarget, MediaData::Type aType)
{
TrackBuffer* trackBuffer = aType == MediaData::AUDIO_DATA ? mAudioTrack : mVideoTrack;
MOZ_ASSERT(trackBuffer);
nsRefPtr<MediaDecoderReader> reader = SelectReader(aTarget, EOS_FUZZ_US, trackBuffer->Decoders());
return !!reader;
nsRefPtr<SourceBufferDecoder> decoder = SelectDecoder(aTarget, EOS_FUZZ_US, trackBuffer->Decoders());
return !!decoder;
}
MediaSourceReader::SwitchReaderResult
MediaSourceReader::SwitchAudioReader(int64_t aTarget)
MediaSourceReader::SwitchSourceResult
MediaSourceReader::SwitchAudioSource(int64_t* aTarget)
{
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
// XXX: Can't handle adding an audio track after ReadMetadata.
if (!mAudioTrack) {
return READER_ERROR;
return SOURCE_ERROR;
}
// We first search without the tolerance and then search with it, so that, in
// the case of perfectly-aligned data, we don't prematurely jump to a new
// reader and skip the last few samples of the current one.
nsRefPtr<MediaDecoderReader> newReader = SelectReader(aTarget, /* aTolerance = */ 0, mAudioTrack->Decoders());
if (!newReader) {
newReader = SelectReader(aTarget, EOS_FUZZ_US, mAudioTrack->Decoders());
bool usedFuzz = false;
nsRefPtr<SourceBufferDecoder> newDecoder =
SelectDecoder(*aTarget, /* aTolerance = */ 0, mAudioTrack->Decoders());
if (!newDecoder) {
newDecoder = SelectDecoder(*aTarget, EOS_FUZZ_US, mAudioTrack->Decoders());
usedFuzz = true;
}
if (newReader && newReader != mAudioReader) {
mAudioReader->SetIdle();
mAudioReader = newReader;
MSE_DEBUGV("MediaSourceReader(%p)::SwitchAudioReader switched reader to %p", this, mAudioReader.get());
return READER_NEW;
if (newDecoder && newDecoder != mAudioSourceDecoder) {
GetAudioReader()->SetIdle();
mAudioSourceDecoder = newDecoder;
if (usedFuzz) {
// A decoder buffered range is continuous. We would have failed the exact
// search but succeeded the fuzzy one if our target was shortly before
// start time.
nsRefPtr<dom::TimeRanges> ranges = new dom::TimeRanges();
newDecoder->GetBuffered(ranges);
int64_t startTime = ranges->GetStartTime() * USECS_PER_S;
if (*aTarget < startTime) {
*aTarget = startTime;
}
}
MSE_DEBUGV("MediaSourceReader(%p)::SwitchAudioSource switched decoder to %p (fuzz:%d)",
this, mAudioSourceDecoder.get(), usedFuzz);
return SOURCE_NEW;
}
return newReader ? READER_EXISTING : READER_ERROR;
return newDecoder ? SOURCE_EXISTING : SOURCE_ERROR;
}
MediaSourceReader::SwitchReaderResult
MediaSourceReader::SwitchVideoReader(int64_t aTarget)
MediaSourceReader::SwitchSourceResult
MediaSourceReader::SwitchVideoSource(int64_t* aTarget)
{
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
// XXX: Can't handle adding a video track after ReadMetadata.
if (!mVideoTrack) {
return READER_ERROR;
return SOURCE_ERROR;
}
// We first search without the tolerance and then search with it, so that, in
// the case of perfectly-aligned data, we don't prematurely jump to a new
// reader and skip the last few samples of the current one.
nsRefPtr<MediaDecoderReader> newReader = SelectReader(aTarget, /* aTolerance = */ 0, mVideoTrack->Decoders());
if (!newReader) {
newReader = SelectReader(aTarget, EOS_FUZZ_US, mVideoTrack->Decoders());
bool usedFuzz = false;
nsRefPtr<SourceBufferDecoder> newDecoder =
SelectDecoder(*aTarget, /* aTolerance = */ 0, mVideoTrack->Decoders());
if (!newDecoder) {
newDecoder = SelectDecoder(*aTarget, EOS_FUZZ_US, mVideoTrack->Decoders());
usedFuzz = true;
}
if (newReader && newReader != mVideoReader) {
mVideoReader->SetIdle();
mVideoReader = newReader;
MSE_DEBUGV("MediaSourceReader(%p)::SwitchVideoReader switched reader to %p", this, mVideoReader.get());
return READER_NEW;
if (newDecoder && newDecoder != mVideoSourceDecoder) {
GetVideoReader()->SetIdle();
mVideoSourceDecoder = newDecoder;
if (usedFuzz) {
// A decoder buffered range is continuous. We would have failed the exact
// search but succeeded the fuzzy one if our target was shortly before
// start time.
nsRefPtr<dom::TimeRanges> ranges = new dom::TimeRanges();
newDecoder->GetBuffered(ranges);
int64_t startTime = ranges->GetStartTime() * USECS_PER_S;
if (*aTarget < startTime) {
*aTarget = startTime;
}
}
MSE_DEBUGV("MediaSourceReader(%p)::SwitchVideoSource switched decoder to %p (fuzz:%d)",
this, mVideoSourceDecoder.get(), usedFuzz);
return SOURCE_NEW;
}
return newReader ? READER_EXISTING : READER_ERROR;
return newDecoder ? SOURCE_EXISTING : SOURCE_ERROR;
}
bool
MediaSourceReader::IsDormantNeeded()
{
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
if (mVideoReader) {
return mVideoReader->IsDormantNeeded();
if (GetVideoReader()) {
return GetVideoReader()->IsDormantNeeded();
}
return false;
@ -534,8 +595,8 @@ void
MediaSourceReader::ReleaseMediaResources()
{
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
if (mVideoReader) {
mVideoReader->ReleaseMediaResources();
if (GetVideoReader()) {
GetVideoReader()->ReleaseMediaResources();
}
}
@ -704,6 +765,9 @@ MediaSourceReader::Seek(int64_t aTime, int64_t aIgnored /* Used only for ogg whi
{
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
mWaitingForSeekData = true;
mDropAudioBeforeThreshold = false;
mDropVideoBeforeThreshold = false;
mTimeThreshold = 0;
}
AttemptSeek();
@ -717,13 +781,13 @@ MediaSourceReader::CancelSeek()
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
mWaitingForSeekData = false;
mPendingSeekTime = -1;
if (mAudioReader) {
if (GetAudioReader()) {
mAudioSeekRequest.DisconnectIfExists();
mAudioReader->CancelSeek();
GetAudioReader()->CancelSeek();
}
if (mVideoReader) {
if (GetVideoReader()) {
mVideoSeekRequest.DisconnectIfExists();
mVideoReader->CancelSeek();
GetVideoReader()->CancelSeek();
}
mSeekPromise.RejectIfExists(NS_OK, __func__);
}
@ -733,12 +797,15 @@ MediaSourceReader::OnVideoSeekCompleted(int64_t aTime)
{
mVideoSeekRequest.Complete();
// The aTime we receive is in the sub-reader's reference.
int64_t ourTime = aTime + mVideoSourceDecoder->GetTimestampOffset();
if (mAudioTrack) {
mPendingSeekTime = aTime;
mPendingSeekTime = ourTime;
DoAudioSeek();
} else {
mPendingSeekTime = -1;
mSeekPromise.Resolve(aTime, __func__);
mSeekPromise.Resolve(ourTime, __func__);
}
}
@ -753,12 +820,12 @@ MediaSourceReader::OnVideoSeekFailed(nsresult aResult)
void
MediaSourceReader::DoAudioSeek()
{
SwitchAudioReader(mPendingSeekTime);
mAudioSeekRequest.Begin(mAudioReader->Seek(mPendingSeekTime, 0)
->RefableThen(GetTaskQueue(), __func__, this,
&MediaSourceReader::OnAudioSeekCompleted,
&MediaSourceReader::OnAudioSeekFailed));
MSE_DEBUG("MediaSourceReader(%p)::DoAudioSeek reader=%p", this, mAudioReader.get());
SwitchAudioSource(&mPendingSeekTime);
mAudioSeekRequest.Begin(GetAudioReader()->Seek(GetReaderAudioTime(mPendingSeekTime), 0)
->RefableThen(GetTaskQueue(), __func__, this,
&MediaSourceReader::OnAudioSeekCompleted,
&MediaSourceReader::OnAudioSeekFailed));
MSE_DEBUG("MediaSourceReader(%p)::DoAudioSeek reader=%p", this, GetAudioReader());
}
void
@ -766,7 +833,9 @@ MediaSourceReader::OnAudioSeekCompleted(int64_t aTime)
{
mAudioSeekRequest.Complete();
mPendingSeekTime = -1;
mSeekPromise.Resolve(aTime, __func__);
// The aTime we receive is in the sub-reader's reference.
mSeekPromise.Resolve(aTime + mAudioSourceDecoder->GetTimestampOffset(),
__func__);
}
void
@ -811,12 +880,12 @@ MediaSourceReader::AttemptSeek()
void
MediaSourceReader::DoVideoSeek()
{
SwitchVideoReader(mPendingSeekTime);
mVideoSeekRequest.Begin(mVideoReader->Seek(mPendingSeekTime, 0)
SwitchVideoSource(&mPendingSeekTime);
mVideoSeekRequest.Begin(GetVideoReader()->Seek(GetReaderVideoTime(mPendingSeekTime), 0)
->RefableThen(GetTaskQueue(), __func__, this,
&MediaSourceReader::OnVideoSeekCompleted,
&MediaSourceReader::OnVideoSeekFailed));
MSE_DEBUG("MediaSourceReader(%p)::DoVideoSeek reader=%p", this, mVideoReader.get());
MSE_DEBUG("MediaSourceReader(%p)::DoVideoSeek reader=%p", this, GetVideoReader());
}
nsresult
@ -903,28 +972,28 @@ MediaSourceReader::ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags)
if (mAudioTrack) {
MOZ_ASSERT(mAudioTrack->IsReady());
mAudioReader = mAudioTrack->Decoders()[0]->GetReader();
mAudioSourceDecoder = mAudioTrack->Decoders()[0];
const MediaInfo& info = mAudioReader->GetMediaInfo();
const MediaInfo& info = GetAudioReader()->GetMediaInfo();
MOZ_ASSERT(info.HasAudio());
mInfo.mAudio = info.mAudio;
mInfo.mIsEncrypted = mInfo.mIsEncrypted || info.mIsEncrypted;
MSE_DEBUG("MediaSourceReader(%p)::ReadMetadata audio reader=%p duration=%lld",
this, mAudioReader.get(),
mAudioReader->GetDecoder()->GetMediaDuration());
this, mAudioSourceDecoder.get(),
mAudioSourceDecoder->GetReader()->GetDecoder()->GetMediaDuration());
}
if (mVideoTrack) {
MOZ_ASSERT(mVideoTrack->IsReady());
mVideoReader = mVideoTrack->Decoders()[0]->GetReader();
mVideoSourceDecoder = mVideoTrack->Decoders()[0];
const MediaInfo& info = mVideoReader->GetMediaInfo();
const MediaInfo& info = GetVideoReader()->GetMediaInfo();
MOZ_ASSERT(info.HasVideo());
mInfo.mVideo = info.mVideo;
mInfo.mIsEncrypted = mInfo.mIsEncrypted || info.mIsEncrypted;
MSE_DEBUG("MediaSourceReader(%p)::ReadMetadata video reader=%p duration=%lld",
this, mVideoReader.get(),
mVideoReader->GetDecoder()->GetMediaDuration());
this, GetVideoReader(),
GetVideoReader()->GetDecoder()->GetMediaDuration());
}
*aInfo = mInfo;
@ -938,18 +1007,18 @@ MediaSourceReader::ReadUpdatedMetadata(MediaInfo* aInfo)
{
if (mAudioTrack) {
MOZ_ASSERT(mAudioTrack->IsReady());
mAudioReader = mAudioTrack->Decoders()[0]->GetReader();
mAudioSourceDecoder = mAudioTrack->Decoders()[0];
const MediaInfo& info = mAudioReader->GetMediaInfo();
const MediaInfo& info = GetAudioReader()->GetMediaInfo();
MOZ_ASSERT(info.HasAudio());
mInfo.mAudio = info.mAudio;
}
if (mVideoTrack) {
MOZ_ASSERT(mVideoTrack->IsReady());
mVideoReader = mVideoTrack->Decoders()[0]->GetReader();
mVideoSourceDecoder = mVideoTrack->Decoders()[0];
const MediaInfo& info = mVideoReader->GetMediaInfo();
const MediaInfo& info = GetVideoReader()->GetMediaInfo();
MOZ_ASSERT(info.HasVideo());
mInfo.mVideo = info.mVideo;
}
@ -999,7 +1068,7 @@ MediaSourceReader::GetMozDebugReaderData(nsAString& aString)
mAudioTrack->Decoders()[i]->GetBuffered(ranges);
result += nsPrintfCString("\t\tReader %d: %p ranges=%s active=%s size=%lld\n",
i, newReader.get(), DumpTimeRanges(ranges).get(),
newReader.get() == mAudioReader.get() ? "true" : "false",
newReader.get() == GetAudioReader() ? "true" : "false",
mAudioTrack->Decoders()[i]->GetResource()->GetSize());
}
}
@ -1013,7 +1082,7 @@ MediaSourceReader::GetMozDebugReaderData(nsAString& aString)
mVideoTrack->Decoders()[i]->GetBuffered(ranges);
result += nsPrintfCString("\t\tReader %d: %p ranges=%s active=%s size=%lld\n",
i, newReader.get(), DumpTimeRanges(ranges).get(),
newReader.get() == mVideoReader.get() ? "true" : "false",
newReader.get() == GetVideoReader() ? "true" : "false",
mVideoTrack->Decoders()[i]->GetResource()->GetSize());
}
}
@ -1040,7 +1109,31 @@ bool
MediaSourceReader::IsActiveReader(MediaDecoderReader* aReader)
{
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
return aReader == mVideoReader.get() || aReader == mAudioReader.get();
return aReader == GetVideoReader() || aReader == GetAudioReader();
}
MediaDecoderReader*
MediaSourceReader::GetAudioReader() const
{
return mAudioSourceDecoder ? mAudioSourceDecoder->GetReader() : nullptr;
}
MediaDecoderReader*
MediaSourceReader::GetVideoReader() const
{
return mVideoSourceDecoder ? mVideoSourceDecoder->GetReader() : nullptr;
}
int64_t
MediaSourceReader::GetReaderAudioTime(int64_t aTime) const
{
return aTime - mAudioSourceDecoder->GetTimestampOffset();
}
int64_t
MediaSourceReader::GetReaderVideoTime(int64_t aTime) const
{
return aTime - mVideoSourceDecoder->GetTimestampOffset();
}
} // namespace mozilla

Просмотреть файл

@ -142,8 +142,8 @@ public:
#endif
virtual bool IsAsync() const MOZ_OVERRIDE {
return (!mAudioReader || mAudioReader->IsAsync()) &&
(!mVideoReader || mVideoReader->IsAsync());
return (!GetAudioReader() || GetAudioReader()->IsAsync()) &&
(!GetVideoReader() || GetVideoReader()->IsAsync());
}
// Returns true if aReader is a currently active audio or video
@ -154,17 +154,19 @@ public:
void GetMozDebugReaderData(nsAString& aString);
private:
// Switch the current audio/video reader to the reader that
// Switch the current audio/video source to the source that
// contains aTarget (or up to aTolerance after target). Both
// aTarget and aTolerance are in microseconds.
enum SwitchReaderResult {
READER_ERROR = -1,
READER_EXISTING = 0,
READER_NEW = 1,
// Search can be made using a fuzz factor. Should an approximated value be
// found instead, aTarget will be updated to the actual target found.
enum SwitchSourceResult {
SOURCE_ERROR = -1,
SOURCE_EXISTING = 0,
SOURCE_NEW = 1,
};
SwitchReaderResult SwitchAudioReader(int64_t aTarget);
SwitchReaderResult SwitchVideoReader(int64_t aTarget);
SwitchSourceResult SwitchAudioSource(int64_t* aTarget);
SwitchSourceResult SwitchVideoSource(int64_t* aTarget);
void DoAudioRequest();
void DoVideoRequest();
@ -193,22 +195,27 @@ private:
mVideoPromise.Reject(DECODE_ERROR, __func__);
}
MediaDecoderReader* GetAudioReader() const;
MediaDecoderReader* GetVideoReader() const;
int64_t GetReaderAudioTime(int64_t aTime) const;
int64_t GetReaderVideoTime(int64_t aTime) const;
// Will reject the MediaPromise with END_OF_STREAM if mediasource has ended
// or with WAIT_FOR_DATA otherwise.
void CheckForWaitOrEndOfStream(MediaData::Type aType, int64_t aTime /* microseconds */);
// Return a reader from the set available in aTrackDecoders that has data
// Return a decoder from the set available in aTrackDecoders that has data
// available in the range requested by aTarget.
already_AddRefed<MediaDecoderReader> SelectReader(int64_t aTarget,
int64_t aTolerance,
const nsTArray<nsRefPtr<SourceBufferDecoder>>& aTrackDecoders);
already_AddRefed<SourceBufferDecoder> SelectDecoder(int64_t aTarget,
int64_t aTolerance,
const nsTArray<nsRefPtr<SourceBufferDecoder>>& aTrackDecoders);
bool HaveData(int64_t aTarget, MediaData::Type aType);
void AttemptSeek();
bool IsSeeking() { return mPendingSeekTime != -1; }
nsRefPtr<MediaDecoderReader> mAudioReader;
nsRefPtr<MediaDecoderReader> mVideoReader;
nsRefPtr<SourceBufferDecoder> mAudioSourceDecoder;
nsRefPtr<SourceBufferDecoder> mVideoSourceDecoder;
nsTArray<nsRefPtr<TrackBuffer>> mTrackBuffers;
nsTArray<nsRefPtr<TrackBuffer>> mShutdownTrackBuffers;
@ -250,6 +257,9 @@ private:
bool mDropAudioBeforeThreshold;
bool mDropVideoBeforeThreshold;
bool mAudioDiscontinuity;
bool mVideoDiscontinuity;
bool mEnded;
double mMediaSourceDuration;

Просмотреть файл

@ -248,6 +248,10 @@ SourceBufferDecoder::GetBuffered(dom::TimeRanges* aBuffered)
if (NS_FAILED(rv)) {
return rv;
}
// Adjust buffered range according to timestamp offset.
aBuffered->Shift((double)mTimestampOffset / USECS_PER_S);
if (!WasTrimmed()) {
return NS_OK;
}
@ -260,7 +264,8 @@ SourceBufferDecoder::GetBuffered(dom::TimeRanges* aBuffered)
int64_t
SourceBufferDecoder::ConvertToByteOffset(double aTime)
{
int64_t readerOffset = mReader->GetEvictionOffset(aTime);
int64_t readerOffset =
mReader->GetEvictionOffset(aTime - double(mTimestampOffset) / USECS_PER_S);
if (readerOffset >= 0) {
return readerOffset;
}
@ -274,7 +279,9 @@ SourceBufferDecoder::ConvertToByteOffset(double aTime)
}
int64_t length = GetResource()->GetLength();
MOZ_ASSERT(length > 0);
int64_t offset = (aTime / (double(mRealMediaDuration) / USECS_PER_S)) * length;
int64_t offset =
((aTime - double(mTimestampOffset) / USECS_PER_S) /
(double(mRealMediaDuration) / USECS_PER_S)) * length;
return offset;
}

Просмотреть файл

@ -42,7 +42,6 @@ public:
virtual bool IsTransportSeekable() MOZ_FINAL MOZ_OVERRIDE;
virtual bool OnDecodeThread() const MOZ_FINAL MOZ_OVERRIDE;
virtual bool OnStateMachineThread() const MOZ_FINAL MOZ_OVERRIDE;
virtual int64_t GetTimestampOffset() const MOZ_FINAL MOZ_OVERRIDE { return mTimestampOffset; }
virtual int64_t GetMediaDuration() MOZ_FINAL MOZ_OVERRIDE;
virtual layers::ImageContainer* GetImageContainer() MOZ_FINAL MOZ_OVERRIDE;
virtual MediaDecoderOwner* GetOwner() MOZ_FINAL MOZ_OVERRIDE;
@ -66,6 +65,8 @@ public:
virtual bool HasInitializationData() MOZ_FINAL MOZ_OVERRIDE;
// SourceBufferResource specific interface below.
int64_t GetTimestampOffset() const { return mTimestampOffset; }
void SetTimestampOffset(int64_t aOffset) { mTimestampOffset = aOffset; }
// Warning: this mirrors GetBuffered in MediaDecoder, but this class's base is
// AbstractMediaDecoder, which does not supply this interface.
@ -77,7 +78,7 @@ public:
mReader = aReader;
}
MediaDecoderReader* GetReader()
MediaDecoderReader* GetReader() const
{
return mReader;
}

Просмотреть файл

@ -39,6 +39,9 @@ extern PRLogModuleInfo* GetMediaSourceAPILog();
// prevent evicting the current playback point.
#define MSE_EVICT_THRESHOLD_TIME 2.0
// Time in microsecond under which a timestamp will be considered to be 0.
#define FUZZ_TIMESTAMP_OFFSET 100000
namespace mozilla {
TrackBuffer::TrackBuffer(MediaSourceDecoder* aParentDecoder, const nsACString& aType)
@ -46,6 +49,7 @@ TrackBuffer::TrackBuffer(MediaSourceDecoder* aParentDecoder, const nsACString& a
, mType(aType)
, mLastStartTimestamp(0)
, mLastTimestampOffset(0)
, mAdjustedTimestamp(0)
, mShutdown(false)
{
MOZ_COUNT_CTOR(TrackBuffer);
@ -185,7 +189,8 @@ TrackBuffer::AppendData(LargeDataBuffer* aData, int64_t aTimestampOffset)
if (newInitData) {
if (!gotInit) {
// We need a new decoder, but we can't initialize it yet.
nsRefPtr<SourceBufferDecoder> decoder = NewDecoder(aTimestampOffset);
nsRefPtr<SourceBufferDecoder> decoder =
NewDecoder(aTimestampOffset - mAdjustedTimestamp);
// The new decoder is stored in mDecoders/mCurrentDecoder, so we
// don't need to do anything with 'decoder'. It's only a placeholder.
if (!decoder) {
@ -193,7 +198,7 @@ TrackBuffer::AppendData(LargeDataBuffer* aData, int64_t aTimestampOffset)
return p;
}
} else {
if (!decoders.NewDecoder(aTimestampOffset)) {
if (!decoders.NewDecoder(aTimestampOffset - mAdjustedTimestamp)) {
mInitializationPromise.Reject(NS_ERROR_FAILURE, __func__);
return p;
}
@ -206,8 +211,6 @@ TrackBuffer::AppendData(LargeDataBuffer* aData, int64_t aTimestampOffset)
}
if (gotMedia) {
start += aTimestampOffset;
end += aTimestampOffset;
if (mLastEndTimestamp &&
(!mParser->TimestampsFuzzyEqual(start, mLastEndTimestamp.value()) ||
mLastTimestampOffset != aTimestampOffset ||
@ -220,7 +223,8 @@ TrackBuffer::AppendData(LargeDataBuffer* aData, int64_t aTimestampOffset)
// This data is earlier in the timeline than data we have already
// processed or not continuous, so we must create a new decoder
// to handle the decoding.
if (!hadCompleteInitData || !decoders.NewDecoder(aTimestampOffset)) {
if (!hadCompleteInitData ||
!decoders.NewDecoder(aTimestampOffset - mAdjustedTimestamp)) {
mInitializationPromise.Reject(NS_ERROR_FAILURE, __func__);
return p;
}
@ -236,6 +240,12 @@ TrackBuffer::AppendData(LargeDataBuffer* aData, int64_t aTimestampOffset)
mLastEndTimestamp.emplace(end);
}
if (gotMedia && start > 0 &&
(start < FUZZ_TIMESTAMP_OFFSET || start < mAdjustedTimestamp)) {
AdjustDecodersTimestampOffset(mAdjustedTimestamp - start);
mAdjustedTimestamp = start;
}
if (!AppendDataToCurrentResource(aData, end - start)) {
mInitializationPromise.Reject(NS_ERROR_FAILURE, __func__);
return p;
@ -915,4 +925,13 @@ TrackBuffer::RangeRemoval(int64_t aStart, int64_t aEnd)
return true;
}
void
TrackBuffer::AdjustDecodersTimestampOffset(int32_t aOffset)
{
ReentrantMonitorAutoEnter mon(mParentDecoder->GetReentrantMonitor());
for (uint32_t i = 0; i < mDecoders.Length(); i++) {
mDecoders[i]->SetTimestampOffset(mDecoders[i]->GetTimestampOffset() + aOffset);
}
}
} // namespace mozilla

Просмотреть файл

@ -190,9 +190,11 @@ private:
// AppendData. Accessed on the main thread only.
int64_t mLastStartTimestamp;
Maybe<int64_t> mLastEndTimestamp;
void AdjustDecodersTimestampOffset(int32_t aOffset);
// The timestamp offset used by our current decoder, in microseconds.
int64_t mLastTimestampOffset;
int64_t mAdjustedTimestamp;
// Set when the first decoder used by this TrackBuffer is initialized.
// Protected by mParentDecoder's monitor.

Просмотреть файл

@ -6,5 +6,6 @@ support-files =
seek.webm
[test_texttrackcue_chrome.html]
skip-if = os=='mac' && debug # bug 1130751
[test_texttrack_chrome.html]
[test_texttracklist_chrome.html]

Просмотреть файл

@ -12,9 +12,6 @@
using mozilla::plugins::PluginInstanceParent;
#endif
#define PWLOG(...)
//#define PWLOG(...) printf_stderr(__VA_ARGS__)
namespace mozilla {
namespace plugins {
@ -26,21 +23,19 @@ PluginWidgetChild::PluginWidgetChild() :
PluginWidgetChild::~PluginWidgetChild()
{
PWLOG("PluginWidgetChild::~PluginWidgetChild()\n");
MOZ_COUNT_DTOR(PluginWidgetChild);
}
/*
* Tear down scenarios
* layout (plugin content unloading):
* - PluginWidgetProxy::Destroy(), calls PluginWidgetChild->SendDestroy(), (proxy disabled)
* - PluginWidgetParent::RecvDestroy(), sends async ParentShutdown()
* - PluginWidgetChild::RecvParentShutdown(), calls Send__delete__()
* - PluginWidgetProxy nsIWidget Destroy()
* - PluginWidgetProxy->PluginWidgetChild->SendDestroy()
* - PluginWidgetParent::RecvDestroy(), sends async Destroyed() to PluginWidgetChild
* - PluginWidgetChild::RecvDestroyed() calls Send__delete__()
* - PluginWidgetParent::ActorDestroy() called in response to __delete__.
* PBrowser teardown (tab closing):
* - TabParent::Destroy()
* - PluginWidgetParent::ParentDestroy(), sends async ParentShutdown()
* - PluginWidgetChild::RecvParentShutdown(), (proxy disabled)
* - PluginWidgetParent::ParentDestroy() called by TabParent::Destroy()
* - PluginWidgetParent::ActorDestroy()
* - PluginWidgetParent::~PluginWidgetParent() in response to PBrowserParent::DeallocSubtree()
* - PluginWidgetChild::ActorDestroy() from PPluginWidgetChild::DestroySubtree
@ -48,7 +43,7 @@ PluginWidgetChild::~PluginWidgetChild()
**/
void
PluginWidgetChild::ShutdownProxy()
PluginWidgetChild::ActorDestroy(ActorDestroyReason aWhy)
{
if (mWidget) {
mWidget->ChannelDestroyed();
@ -56,21 +51,10 @@ PluginWidgetChild::ShutdownProxy()
mWidget = nullptr;
}
void
PluginWidgetChild::ActorDestroy(ActorDestroyReason aWhy)
{
PWLOG("PluginWidgetChild::ActorDestroy(%d)\n", aWhy);
ShutdownProxy(); // backup
}
bool
PluginWidgetChild::RecvParentShutdown(const bool& aParentInitiated)
PluginWidgetChild::RecvParentShutdown()
{
PWLOG("PluginWidgetChild::RecvParentShutdown(%d)\n", aParentInitiated);
ShutdownProxy();
if (!aParentInitiated) {
Send__delete__(this);
}
Send__delete__(this);
return true;
}

Просмотреть файл

@ -21,9 +21,7 @@ public:
virtual bool RecvUpdateWindow(const uintptr_t& aChildId) MOZ_OVERRIDE;
virtual void ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
virtual bool RecvParentShutdown(const bool& aParentInitiated) MOZ_OVERRIDE;
void ShutdownProxy();
virtual bool RecvParentShutdown() MOZ_OVERRIDE;
mozilla::widget::PluginWidgetProxy* mWidget;
};

Просмотреть файл

@ -75,6 +75,14 @@ PluginWidgetParent::GetTabParent()
return static_cast<mozilla::dom::TabParent*>(Manager());
}
void
PluginWidgetParent::SetParent(nsIWidget* aParent)
{
if (mWidget && aParent) {
mWidget->SetParent(aParent);
}
}
#if defined(XP_WIN)
// static
void
@ -175,23 +183,8 @@ PluginWidgetParent::RecvCreate(nsresult* aResult)
void
PluginWidgetParent::ActorDestroy(ActorDestroyReason aWhy)
{
PWLOG("PluginWidgetParent::ActorDestroy()\n");
}
void
PluginWidgetParent::ShutdownCommon(bool aParentInitiated)
{
if (mActorDestroyed || !mWidget) {
return;
}
PWLOG("PluginWidgetParent::ShutdownCommon()\n");
mWidget->UnregisterPluginWindowForRemoteUpdates();
DebugOnly<nsresult> rv = mWidget->Destroy();
NS_ASSERTION(NS_SUCCEEDED(rv), "widget destroy failure");
mWidget = nullptr;
mActorDestroyed = true;
unused << SendParentShutdown(aParentInitiated);
PWLOG("PluginWidgetParent::ActorDestroy()\n");
}
// Called by TabParent's Destroy() in response to an early tear down (Early
@ -201,8 +194,16 @@ PluginWidgetParent::ShutdownCommon(bool aParentInitiated)
void
PluginWidgetParent::ParentDestroy()
{
if (mActorDestroyed || !mWidget) {
return;
}
PWLOG("PluginWidgetParent::ParentDestroy()\n");
ShutdownCommon(true);
mWidget->UnregisterPluginWindowForRemoteUpdates();
DebugOnly<nsresult> rv = mWidget->Destroy();
NS_ASSERTION(NS_SUCCEEDED(rv), "widget destroy failure");
mWidget = nullptr;
mActorDestroyed = true;
return;
}
// Called by the child when a plugin is torn down within a tab
@ -210,8 +211,11 @@ PluginWidgetParent::ParentDestroy()
bool
PluginWidgetParent::RecvDestroy()
{
PWLOG("PluginWidgetParent::RecvDestroy()\n");
ShutdownCommon(false);
bool destroyed = mActorDestroyed;
ParentDestroy();
if (!destroyed) {
unused << SendParentShutdown();
}
return true;
}

Просмотреть файл

@ -48,9 +48,10 @@ public:
// Called by PBrowser when it receives a Destroy() call from the child.
void ParentDestroy();
private:
void ShutdownCommon(bool aParentInitiated);
// Sets mWidget's parent
void SetParent(nsIWidget* aParent);
private:
// The tab our connection is associated with.
mozilla::dom::TabParent* GetTabParent();
// The chrome side native widget.

Просмотреть файл

@ -10692,6 +10692,8 @@ StkCommandParamsFactoryObject.prototype = {
* The value object of CommandDetails TLV.
* @param ctlvs
* The all TLVs in this proactive command.
* @param onComplete
* Callback to be called when complete.
*/
processRefresh: function(cmdDetails, ctlvs, onComplete) {
let refreshType = cmdDetails.commandQualifier;
@ -10720,8 +10722,11 @@ StkCommandParamsFactoryObject.prototype = {
* The value object of CommandDetails TLV.
* @param ctlvs
* The all TLVs in this proactive command.
* @param onComplete
* Callback to be called when complete.
*/
processPollInterval: function(cmdDetails, ctlvs, onComplete) {
// Duration is mandatory.
let ctlv = this.context.StkProactiveCmdHelper.searchForTag(
COMPREHENSIONTLV_TAG_DURATION, ctlvs);
if (!ctlv) {
@ -10741,6 +10746,8 @@ StkCommandParamsFactoryObject.prototype = {
* The value object of CommandDetails TLV.
* @param ctlvs
* The all TLVs in this proactive command.
* @param onComplete
* Callback to be called when complete.
*/
processPollOff: function(cmdDetails, ctlvs, onComplete) {
onComplete(null);
@ -10753,8 +10760,11 @@ StkCommandParamsFactoryObject.prototype = {
* The value object of CommandDetails TLV.
* @param ctlvs
* The all TLVs in this proactive command.
* @param onComplete
* Callback to be called when complete.
*/
processSetUpEventList: function(cmdDetails, ctlvs, onComplete) {
// Event list is mandatory.
let ctlv = this.context.StkProactiveCmdHelper.searchForTag(
COMPREHENSIONTLV_TAG_EVENT_LIST, ctlvs);
if (!ctlv) {
@ -10768,16 +10778,21 @@ StkCommandParamsFactoryObject.prototype = {
},
/**
* Construct a param for Select Item.
* Construct a param for Setup Menu.
*
* @param cmdDetails
* The value object of CommandDetails TLV.
* @param ctlvs
* The all TLVs in this proactive command.
* @param onComplete
* Callback to be called when complete.
*/
processSelectItem: function(cmdDetails, ctlvs, onComplete) {
processSetupMenu: function(cmdDetails, ctlvs, onComplete) {
let StkProactiveCmdHelper = this.context.StkProactiveCmdHelper;
let menu = {};
let menu = {
// Help information available.
isHelpAvailable: !!(cmdDetails.commandQualifier & 0x80)
};
let selectedCtlvs = StkProactiveCmdHelper.searchForSelectedTags(ctlvs, [
COMPREHENSIONTLV_TAG_ALPHA_ID,
@ -10788,11 +10803,13 @@ StkCommandParamsFactoryObject.prototype = {
COMPREHENSIONTLV_TAG_ICON_ID_LIST
]);
// Alpha identifier is optional.
let ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_ALPHA_ID);
if (ctlv) {
menu.title = ctlv.value.identifier;
}
// Item data object for item 1 is mandatory.
let menuCtlvs = selectedCtlvs[COMPREHENSIONTLV_TAG_ITEM];
if (!menuCtlvs) {
this.context.RIL.sendStkTerminalResponse({
@ -10802,32 +10819,26 @@ StkCommandParamsFactoryObject.prototype = {
}
menu.items = menuCtlvs.map(aCtlv => aCtlv.value);
// Item identifier is optional.
ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_ITEM_ID);
if (ctlv) {
menu.defaultItem = ctlv.value.identifier - 1;
}
if (cmdDetails.typeOfCommand == STK_CMD_SELECT_ITEM) {
// The 1st bit and 2nd bit determines the presentation type.
menu.presentationType = cmdDetails.commandQualifier & 0x03;
}
// Help information available.
if (cmdDetails.commandQualifier & 0x80) {
menu.isHelpAvailable = true;
}
// Items next action indicator is optional.
ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_NEXT_ACTION_IND);
if (ctlv) {
menu.nextActionList = ctlv.value;
}
// Icon identifier is optional.
let iconIdCtlvs = null;
let menuIconCtlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_ICON_ID);
if (menuIconCtlv) {
iconIdCtlvs = [menuIconCtlv];
}
// Item icon identifier list is optional.
ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_ICON_ID_LIST);
if (ctlv) {
if (!iconIdCtlvs) {
@ -10860,9 +10871,40 @@ StkCommandParamsFactoryObject.prototype = {
});
},
/**
* Construct a param for Select Item.
*
* @param cmdDetails
* The value object of CommandDetails TLV.
* @param ctlvs
* The all TLVs in this proactive command.
* @param onComplete
* Callback to be called when complete.
*/
processSelectItem: function(cmdDetails, ctlvs, onComplete) {
this.processSetupMenu(cmdDetails, ctlvs, (menu) => {
// The 1st bit and 2nd bit determines the presentation type.
menu.presentationType = cmdDetails.commandQualifier & 0x03;
onComplete(menu);
});
},
/**
* Construct a param for Display Text.
*
* @param cmdDetails
* The value object of CommandDetails TLV.
* @param ctlvs
* The all TLVs in this proactive command.
* @param onComplete
* Callback to be called when complete.
*/
processDisplayText: function(cmdDetails, ctlvs, onComplete) {
let StkProactiveCmdHelper = this.context.StkProactiveCmdHelper;
let textMsg = {};
let textMsg = {
isHighPriority: !!(cmdDetails.commandQualifier & 0x01),
userClear: !!(cmdDetails.commandQualifier & 0x80)
};
let selectedCtlvs = StkProactiveCmdHelper.searchForSelectedTags(ctlvs, [
COMPREHENSIONTLV_TAG_TEXT_STRING,
@ -10871,6 +10913,7 @@ StkCommandParamsFactoryObject.prototype = {
COMPREHENSIONTLV_TAG_ICON_ID
]);
// Text string is mandatory.
let ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_TEXT_STRING);
if (!ctlv) {
this.context.RIL.sendStkTerminalResponse({
@ -10880,31 +10923,32 @@ StkCommandParamsFactoryObject.prototype = {
}
textMsg.text = ctlv.value.textString;
ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_IMMEDIATE_RESPONSE);
if (ctlv) {
textMsg.responseNeeded = true;
}
// Immediate response is optional.
textMsg.responseNeeded =
!!(selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_IMMEDIATE_RESPONSE));
// Duration is optional.
ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_DURATION);
if (ctlv) {
textMsg.duration = ctlv.value;
}
// High priority.
if (cmdDetails.commandQualifier & 0x01) {
textMsg.isHighPriority = true;
}
// User clear.
if (cmdDetails.commandQualifier & 0x80) {
textMsg.userClear = true;
}
// Icon identifier is optional.
this.appendIconIfNecessary(selectedCtlvs[COMPREHENSIONTLV_TAG_ICON_ID] || null,
textMsg,
onComplete);
},
/**
* Construct a param for Setup Idle Mode Text.
*
* @param cmdDetails
* The value object of CommandDetails TLV.
* @param ctlvs
* The all TLVs in this proactive command.
* @param onComplete
* Callback to be called when complete.
*/
processSetUpIdleModeText: function(cmdDetails, ctlvs, onComplete) {
let StkProactiveCmdHelper = this.context.StkProactiveCmdHelper;
let textMsg = {};
@ -10914,6 +10958,7 @@ StkCommandParamsFactoryObject.prototype = {
COMPREHENSIONTLV_TAG_ICON_ID
]);
// Text string is mandatory.
let ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_TEXT_STRING);
if (!ctlv) {
this.context.RIL.sendStkTerminalResponse({
@ -10923,14 +10968,35 @@ StkCommandParamsFactoryObject.prototype = {
}
textMsg.text = ctlv.value.textString;
// Icon identifier is optional.
this.appendIconIfNecessary(selectedCtlvs[COMPREHENSIONTLV_TAG_ICON_ID] || null,
textMsg,
onComplete);
},
/**
* Construct a param for Get Inkey.
*
* @param cmdDetails
* The value object of CommandDetails TLV.
* @param ctlvs
* The all TLVs in this proactive command.
* @param onComplete
* Callback to be called when complete.
*/
processGetInkey: function(cmdDetails, ctlvs, onComplete) {
let StkProactiveCmdHelper = this.context.StkProactiveCmdHelper;
let input = {};
let input = {
minLength: 1,
maxLength: 1,
isAlphabet: !!(cmdDetails.commandQualifier & 0x01),
isUCS2: !!(cmdDetails.commandQualifier & 0x02),
// Character sets defined in bit 1 and bit 2 are disable and
// the YES/NO reponse is required.
isYesNoRequested: !!(cmdDetails.commandQualifier & 0x04),
// Help information available.
isHelpAvailable: !!(cmdDetails.commandQualifier & 0x80)
};
let selectedCtlvs = StkProactiveCmdHelper.searchForSelectedTags(ctlvs, [
COMPREHENSIONTLV_TAG_TEXT_STRING,
@ -10938,6 +11004,7 @@ StkCommandParamsFactoryObject.prototype = {
COMPREHENSIONTLV_TAG_ICON_ID
]);
// Text string is mandatory.
let ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_TEXT_STRING);
if (!ctlv) {
this.context.RIL.sendStkTerminalResponse({
@ -10947,44 +11014,40 @@ StkCommandParamsFactoryObject.prototype = {
}
input.text = ctlv.value.textString;
// duration
// Duration is optional.
ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_DURATION);
if (ctlv) {
input.duration = ctlv.value;
}
input.minLength = 1;
input.maxLength = 1;
// isAlphabet
if (cmdDetails.commandQualifier & 0x01) {
input.isAlphabet = true;
}
// UCS2
if (cmdDetails.commandQualifier & 0x02) {
input.isUCS2 = true;
}
// Character sets defined in bit 1 and bit 2 are disable and
// the YES/NO reponse is required.
if (cmdDetails.commandQualifier & 0x04) {
input.isYesNoRequested = true;
}
// Help information available.
if (cmdDetails.commandQualifier & 0x80) {
input.isHelpAvailable = true;
}
// Icon identifier is optional.
this.appendIconIfNecessary(selectedCtlvs[COMPREHENSIONTLV_TAG_ICON_ID] || null,
input,
onComplete);
},
/**
* Construct a param for Get Input.
*
* @param cmdDetails
* The value object of CommandDetails TLV.
* @param ctlvs
* The all TLVs in this proactive command.
* @param onComplete
* Callback to be called when complete.
*/
processGetInput: function(cmdDetails, ctlvs, onComplete) {
let StkProactiveCmdHelper = this.context.StkProactiveCmdHelper;
let input = {};
let input = {
isAlphabet: !!(cmdDetails.commandQualifier & 0x01),
isUCS2: !!(cmdDetails.commandQualifier & 0x02),
// User input shall not be revealed
hideInput: !!(cmdDetails.commandQualifier & 0x04),
// User input in SMS packed format
isPacked: !!(cmdDetails.commandQualifier & 0x08),
// Help information available.
isHelpAvailable: !!(cmdDetails.commandQualifier & 0x80)
};
let selectedCtlvs = StkProactiveCmdHelper.searchForSelectedTags(ctlvs, [
COMPREHENSIONTLV_TAG_TEXT_STRING,
@ -10993,6 +11056,7 @@ StkCommandParamsFactoryObject.prototype = {
COMPREHENSIONTLV_TAG_ICON_ID
]);
// Text string is mandatory.
let ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_TEXT_STRING);
if (!ctlv) {
this.context.RIL.sendStkTerminalResponse({
@ -11002,47 +11066,39 @@ StkCommandParamsFactoryObject.prototype = {
}
input.text = ctlv.value.textString;
// Response length is mandatory.
ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_RESPONSE_LENGTH);
if (ctlv) {
input.minLength = ctlv.value.minLength;
input.maxLength = ctlv.value.maxLength;
if (!ctlv) {
this.context.RIL.sendStkTerminalResponse({
command: cmdDetails,
resultCode: STK_RESULT_REQUIRED_VALUES_MISSING});
throw new Error("Stk Get Input: Required value missing : Response Length");
}
input.minLength = ctlv.value.minLength;
input.maxLength = ctlv.value.maxLength;
// Default text is optional.
ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_DEFAULT_TEXT);
if (ctlv) {
input.defaultText = ctlv.value.textString;
}
// Alphabet only
if (cmdDetails.commandQualifier & 0x01) {
input.isAlphabet = true;
}
// UCS2
if (cmdDetails.commandQualifier & 0x02) {
input.isUCS2 = true;
}
// User input shall not be revealed
if (cmdDetails.commandQualifier & 0x04) {
input.hideInput = true;
}
// User input in SMS packed format
if (cmdDetails.commandQualifier & 0x08) {
input.isPacked = true;
}
// Help information available.
if (cmdDetails.commandQualifier & 0x80) {
input.isHelpAvailable = true;
}
// Icon identifier is optional.
this.appendIconIfNecessary(selectedCtlvs[COMPREHENSIONTLV_TAG_ICON_ID] || null,
input,
onComplete);
},
/**
* Construct a param for SendSS/SMS/USSD/DTMF.
*
* @param cmdDetails
* The value object of CommandDetails TLV.
* @param ctlvs
* The all TLVs in this proactive command.
* @param onComplete
* Callback to be called when complete.
*/
processEventNotify: function(cmdDetails, ctlvs, onComplete) {
let StkProactiveCmdHelper = this.context.StkProactiveCmdHelper;
let textMsg = {};
@ -11052,16 +11108,28 @@ StkCommandParamsFactoryObject.prototype = {
COMPREHENSIONTLV_TAG_ICON_ID
]);
// Alpha identifier is optional.
let ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_ALPHA_ID);
if (ctlv) {
textMsg.text = ctlv.value.identifier;
}
// Icon identifier is optional.
this.appendIconIfNecessary(selectedCtlvs[COMPREHENSIONTLV_TAG_ICON_ID] || null,
textMsg,
onComplete);
},
/**
* Construct a param for Setup Call.
*
* @param cmdDetails
* The value object of CommandDetails TLV.
* @param ctlvs
* The all TLVs in this proactive command.
* @param onComplete
* Callback to be called when complete.
*/
processSetupCall: function(cmdDetails, ctlvs, onComplete) {
let StkProactiveCmdHelper = this.context.StkProactiveCmdHelper;
let call = {};
@ -11075,6 +11143,7 @@ StkCommandParamsFactoryObject.prototype = {
COMPREHENSIONTLV_TAG_DURATION
]);
// Address is mandatory.
let ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_ADDRESS);
if (!ctlv) {
this.context.RIL.sendStkTerminalResponse({
@ -11084,24 +11153,27 @@ StkCommandParamsFactoryObject.prototype = {
}
call.address = ctlv.value.number;
// Alpha identifier (user confirmation phase) is optional.
ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_ALPHA_ID);
if (ctlv) {
confirmMessage.text = ctlv.value.identifier;
call.confirmMessage = confirmMessage;
}
// Alpha identifier (call set up phase) is optional.
ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_ALPHA_ID);
if (ctlv) {
callMessage.text = ctlv.value.identifier;
call.callMessage = callMessage;
}
// see 3GPP TS 31.111 section 6.4.13
// Duration is optional.
ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_DURATION);
if (ctlv) {
call.duration = ctlv.value;
}
// Icon identifier is optional.
let iconIdCtlvs = selectedCtlvs[COMPREHENSIONTLV_TAG_ICON_ID] || null;
this.loadIcons(iconIdCtlvs, (aIcons) => {
if (aIcons) {
@ -11122,9 +11194,21 @@ StkCommandParamsFactoryObject.prototype = {
});
},
/**
* Construct a param for Launch Browser.
*
* @param cmdDetails
* The value object of CommandDetails TLV.
* @param ctlvs
* The all TLVs in this proactive command.
* @param onComplete
* Callback to be called when complete.
*/
processLaunchBrowser: function(cmdDetails, ctlvs, onComplete) {
let StkProactiveCmdHelper = this.context.StkProactiveCmdHelper;
let browser = {};
let browser = {
mode: cmdDetails.commandQualifier & 0x03
};
let confirmMessage = {};
let selectedCtlvs = StkProactiveCmdHelper.searchForSelectedTags(ctlvs, [
@ -11133,6 +11217,7 @@ StkCommandParamsFactoryObject.prototype = {
COMPREHENSIONTLV_TAG_ICON_ID
]);
// URL is mandatory.
let ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_URL);
if (!ctlv) {
this.context.RIL.sendStkTerminalResponse({
@ -11142,14 +11227,14 @@ StkCommandParamsFactoryObject.prototype = {
}
browser.url = ctlv.value.url;
browser.mode = cmdDetails.commandQualifier & 0x03;
// Alpha identifier is optional.
ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_ALPHA_ID);
if (ctlv) {
confirmMessage.text = ctlv.value.identifier;
browser.confirmMessage = confirmMessage;
}
// Icon identifier is optional.
let iconIdCtlvs = selectedCtlvs[COMPREHENSIONTLV_TAG_ICON_ID] || null;
this.loadIcons(iconIdCtlvs, (aIcons) => {
if (aIcons) {
@ -11163,9 +11248,22 @@ StkCommandParamsFactoryObject.prototype = {
});
},
/**
* Construct a param for Play Tone.
*
* @param cmdDetails
* The value object of CommandDetails TLV.
* @param ctlvs
* The all TLVs in this proactive command.
* @param onComplete
* Callback to be called when complete.
*/
processPlayTone: function(cmdDetails, ctlvs, onComplete) {
let StkProactiveCmdHelper = this.context.StkProactiveCmdHelper;
let playTone = {};
let playTone = {
// The vibrate is only defined in TS 102.223.
isVibrate: !!(cmdDetails.commandQualifier & 0x01)
};
let selectedCtlvs = StkProactiveCmdHelper.searchForSelectedTags(ctlvs, [
COMPREHENSIONTLV_TAG_ALPHA_ID,
@ -11174,36 +11272,39 @@ StkCommandParamsFactoryObject.prototype = {
COMPREHENSIONTLV_TAG_ICON_ID
]);
// Alpha identifier is optional.
let ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_ALPHA_ID);
if (ctlv) {
playTone.text = ctlv.value.identifier;
}
// Tone is optional.
ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_TONE);
if (ctlv) {
playTone.tone = ctlv.value.tone;
}
// Duration is optional.
ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_DURATION);
if (ctlv) {
playTone.duration = ctlv.value;
}
// vibrate is only defined in TS 102.223
playTone.isVibrate = (cmdDetails.commandQualifier & 0x01) !== 0x00;
// Icon identifier is optional.
this.appendIconIfNecessary(selectedCtlvs[COMPREHENSIONTLV_TAG_ICON_ID] || null,
playTone,
onComplete);
},
/**
* Construct a param for Provide Local Information
* Construct a param for Provide Local Information.
*
* @param cmdDetails
* The value object of CommandDetails TLV.
* @param ctlvs
* The all TLVs in this proactive command.
* @param onComplete
* Callback to be called when complete.
*/
processProvideLocalInfo: function(cmdDetails, ctlvs, onComplete) {
let provideLocalInfo = {
@ -11213,6 +11314,16 @@ StkCommandParamsFactoryObject.prototype = {
onComplete(provideLocalInfo);
},
/**
* Construct a param for Timer Management.
*
* @param cmdDetails
* The value object of CommandDetails TLV.
* @param ctlvs
* The all TLVs in this proactive command.
* @param onComplete
* Callback to be called when complete.
*/
processTimerManagement: function(cmdDetails, ctlvs, onComplete) {
let StkProactiveCmdHelper = this.context.StkProactiveCmdHelper;
let timer = {
@ -11224,11 +11335,17 @@ StkCommandParamsFactoryObject.prototype = {
COMPREHENSIONTLV_TAG_TIMER_VALUE
]);
// Timer identifier is mandatory.
let ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_TIMER_IDENTIFIER);
if (ctlv) {
timer.timerId = ctlv.value.timerId;
if (!ctlv) {
this.context.RIL.sendStkTerminalResponse({
command: cmdDetails,
resultCode: STK_RESULT_REQUIRED_VALUES_MISSING});
throw new Error("Stk Timer Management: Required value missing : Timer Identifier");
}
timer.timerId = ctlv.value.timerId;
// Timer value is conditional.
ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_TIMER_VALUE);
if (ctlv) {
timer.timerValue = ctlv.value.timerValue;
@ -11244,6 +11361,8 @@ StkCommandParamsFactoryObject.prototype = {
* The value object of CommandDetails TLV.
* @param ctlvs
* The all TLVs in this proactive command.
* @param onComplete
* Callback to be called when complete.
*/
processBipMessage: function(cmdDetails, ctlvs, onComplete) {
let StkProactiveCmdHelper = this.context.StkProactiveCmdHelper;
@ -11254,11 +11373,13 @@ StkCommandParamsFactoryObject.prototype = {
COMPREHENSIONTLV_TAG_ICON_ID
]);
// Alpha identifier is optional.
let ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_ALPHA_ID);
if (ctlv) {
bipMsg.text = ctlv.value.identifier;
}
// Icon identifier is optional.
this.appendIconIfNecessary(selectedCtlvs[COMPREHENSIONTLV_TAG_ICON_ID] || null,
bipMsg,
onComplete);
@ -11280,7 +11401,7 @@ StkCommandParamsFactoryObject.prototype[STK_CMD_SET_UP_EVENT_LIST] = function ST
return this.processSetUpEventList(cmdDetails, ctlvs, onComplete);
};
StkCommandParamsFactoryObject.prototype[STK_CMD_SET_UP_MENU] = function STK_CMD_SET_UP_MENU(cmdDetails, ctlvs, onComplete) {
return this.processSelectItem(cmdDetails, ctlvs, onComplete);
return this.processSetupMenu(cmdDetails, ctlvs, onComplete);
};
StkCommandParamsFactoryObject.prototype[STK_CMD_SELECT_ITEM] = function STK_CMD_SELECT_ITEM(cmdDetails, ctlvs, onComplete) {
return this.processSelectItem(cmdDetails, ctlvs, onComplete);

Просмотреть файл

@ -770,6 +770,7 @@ add_test(function test_icc_notify_stk_proactive_command() {
typeOfCommand: RIL.STK_CMD_SELECT_ITEM,
commandQualifier: RIL.STK_PRESENTATION_TYPE_NOT_SPECIFIED,
options: {
title: null,
items: [
{ identifier: 0x01, text: "Menu Item 1" },
{ identifier: 0x02, text: "Menu Item 2" },
@ -915,6 +916,7 @@ add_test(function test_icc_notify_stk_proactive_command() {
isUCS2: false,
isYesNoRequested: true,
isHelpAvailable: true,
defaultText: null,
iconSelfExplanatory: false,
icons: [colorIcon]
}
@ -934,6 +936,7 @@ add_test(function test_icc_notify_stk_proactive_command() {
hideInput: true,
isPacked: true,
isHelpAvailable: false,
defaultText: null,
iconSelfExplanatory: true,
icons: [basicIcon]
}
@ -1001,6 +1004,7 @@ add_test(function test_icc_notify_stk_proactive_command() {
typeOfCommand: RIL.STK_CMD_PLAY_TONE,
commandQualifier: 0x01, // isVibrate
options: {
text: null,
isVibrate: true
}
},
@ -1048,6 +1052,7 @@ add_test(function test_icc_notify_stk_proactive_command() {
typeOfCommand: RIL.STK_CMD_OPEN_CHANNEL,
commandQualifier: 0x00, //RFU
options: {
text: null,
}
},
// STK_CMD_OPEN_CHANNEL with optional properties.
@ -1078,6 +1083,7 @@ add_test(function test_icc_notify_stk_proactive_command() {
typeOfCommand: RIL.STK_CMD_SEND_DATA,
commandQualifier: 0x00, //RFU
options: {
text: null,
iconSelfExplanatory: false,
icons: [basicIcon]
}

Просмотреть файл

@ -507,9 +507,8 @@ TelephonyService.prototype = {
return;
}
// Dial a non-emergency call when only emergency call is allowed.
if (!isEmergencyNumber &&
(aIsDialEmergency || this._isEmergencyOnly(aClientId))) {
// DialEmergency accepts only emergency number.
if (aIsDialEmergency && !isEmergencyNumber) {
if (DEBUG) debug("Error: Dail a non-emergency by dialEmergency. Drop.");
aCallback.notifyError(DIAL_ERROR_BAD_NUMBER);
return;
@ -591,6 +590,11 @@ TelephonyService.prototype = {
}
let isEmergency = gDialNumberUtils.isEmergency(aNumber);
if (!isEmergency && this._isEmergencyOnly()) {
if (DEBUG) debug("Error: Dail a normal call when emergencyCallsOnly. Drop");
aCallback.notifyError(DIAL_ERROR_BAD_NUMBER);
}
if (isEmergency) {
// Automatically select a proper clientId for emergency call.
aClientId = gRadioInterfaceLayer.getClientIdForEmergencyCall() ;

Просмотреть файл

@ -142,7 +142,7 @@ interface XMLHttpRequest : XMLHttpRequestEventTarget {
[Throws]
void sendAsBinary(DOMString body);
[Throws, ChromeOnly]
[Throws, ChromeOnly, Exposed=Window]
any getInterface(IID iid);
readonly attribute boolean mozAnon;

Просмотреть файл

@ -28,6 +28,4 @@ skip-if = buildapp == 'mulet'
[test_htmleditor_keyevent_handling.html]
[test_selection_move_commands.xul]
[test_texteditor_keyevent_handling.html]
# disables the key handling test on gtk because gtk overrides some key events
# on our editor, and the combinations depend on the system.
skip-if = toolkit == "gtk2" || toolkit == "gtk3"
skip-if = (debug && os=='win') || (os == 'linux') # Bug 1116205, leaks on windows debug, fails delete key on linux

Просмотреть файл

@ -583,7 +583,7 @@ CopyFrontToBack(TextureClient* aFront,
return false;
}
if (!aBack->Lock(OpenMode::OPEN_WRITE)) {
if (!aBack->Lock(OpenMode::OPEN_READ_WRITE)) {
NS_WARNING("Failed to lock the tile's back buffer");
return false;
}

Просмотреть файл

@ -1120,6 +1120,15 @@ CompositorD3D11::EndFrame()
nsIntSize oldSize = mSize;
EnsureSize();
UINT presentInterval = 0;
if (gfxWindowsPlatform::GetPlatform()->IsWARP()) {
// When we're using WARP we cannot present immediately as it causes us
// to tear when rendering. When not using WARP it appears the DWM takes
// care of tearing for us.
presentInterval = 1;
}
if (oldSize == mSize) {
RefPtr<IDXGISwapChain1> chain;
HRESULT hr = mSwapChain->QueryInterface((IDXGISwapChain1**)byRef(chain));
@ -1144,9 +1153,9 @@ CompositorD3D11::EndFrame()
}
params.pDirtyRects = &rects.front();
chain->Present1(0, mDisableSequenceForNextFrame ? DXGI_PRESENT_DO_NOT_SEQUENCE : 0, &params);
chain->Present1(presentInterval, mDisableSequenceForNextFrame ? DXGI_PRESENT_DO_NOT_SEQUENCE : 0, &params);
} else {
mSwapChain->Present(0, mDisableSequenceForNextFrame ? DXGI_PRESENT_DO_NOT_SEQUENCE : 0);
mSwapChain->Present(presentInterval, mDisableSequenceForNextFrame ? DXGI_PRESENT_DO_NOT_SEQUENCE : 0);
}
mDisableSequenceForNextFrame = false;
if (mTarget) {

Просмотреть файл

@ -135,10 +135,6 @@ static qcms_transform *gCMSRGBATransform = nullptr;
static bool gCMSInitialized = false;
static eCMSMode gCMSMode = eCMSMode_Off;
static bool gCMSIntentInitialized = false;
static int gCMSIntent = QCMS_INTENT_DEFAULT;
static void ShutdownCMS();
#include "mozilla/gfx/2D.h"
@ -1752,9 +1748,7 @@ gfxPlatform::OffMainThreadCompositingEnabled()
eCMSMode
gfxPlatform::GetCMSMode()
{
if (gCMSInitialized == false) {
gCMSInitialized = true;
if (!gCMSInitialized) {
int32_t mode = gfxPrefs::CMSMode();
if (mode >= 0 && mode < eCMSMode_AllCount) {
gCMSMode = static_cast<eCMSMode>(mode);
@ -1764,6 +1758,7 @@ gfxPlatform::GetCMSMode()
if (enableV4) {
qcms_enable_iccv4();
}
gCMSInitialized = true;
}
return gCMSMode;
}
@ -1771,25 +1766,19 @@ gfxPlatform::GetCMSMode()
int
gfxPlatform::GetRenderingIntent()
{
if (!gCMSIntentInitialized) {
gCMSIntentInitialized = true;
// gfxPrefs.h is using 0 as the default for the rendering
// intent preference, based on that being the value for
// QCMS_INTENT_DEFAULT. Assert here to catch if that ever
// changes and we can then figure out what to do about it.
MOZ_ASSERT(QCMS_INTENT_DEFAULT == 0);
// gfxPrefs.h is using 0 as the default for the rendering
// intent preference, based on that being the value for
// QCMS_INTENT_DEFAULT. Assert here to catch if that ever
// changes and we can then figure out what to do about it.
MOZ_ASSERT(QCMS_INTENT_DEFAULT == 0);
/* Try to query the pref system for a rendering intent. */
int32_t pIntent = gfxPrefs::CMSRenderingIntent();
if ((pIntent >= QCMS_INTENT_MIN) && (pIntent <= QCMS_INTENT_MAX)) {
gCMSIntent = pIntent;
} else {
/* If the pref is out of range, use embedded profile. */
gCMSIntent = -1;
}
}
return gCMSIntent;
/* Try to query the pref system for a rendering intent. */
int32_t pIntent = gfxPrefs::CMSRenderingIntent();
if ((pIntent < QCMS_INTENT_MIN) || (pIntent > QCMS_INTENT_MAX)) {
/* If the pref is out of range, use embedded profile. */
pIntent = -1;
}
return pIntent;
}
void
@ -1987,7 +1976,6 @@ static void ShutdownCMS()
}
// Reset the state variables
gCMSIntent = -2;
gCMSMode = eCMSMode_Off;
gCMSInitialized = false;
}

Просмотреть файл

@ -45,7 +45,7 @@ namespace JS {
#define GCREASONS(D) \
/* Reasons internal to the JS engine */ \
D(API) \
D(MAYBEGC) \
D(EAGER_ALLOC_TRIGGER) \
D(DESTROY_RUNTIME) \
D(DESTROY_CONTEXT) \
D(LAST_DITCH) \
@ -58,6 +58,7 @@ namespace JS {
D(EVICT_NURSERY) \
D(FULL_STORE_BUFFER) \
D(SHARED_MEMORY_LIMIT) \
D(PERIODIC_FULL_GC) \
\
/* These are reserved for future use. */ \
D(RESERVED0) \
@ -78,7 +79,6 @@ namespace JS {
D(RESERVED15) \
D(RESERVED16) \
D(RESERVED17) \
D(RESERVED18) \
\
/* Reasons from Firefox */ \
D(DOM_WINDOW_UTILS) \

Просмотреть файл

@ -44,7 +44,6 @@
#include "vm/HelperThreads.h"
#include "vm/Interpreter.h"
#include "jsinferinlines.h"
#include "jsobjinlines.h"
#include "frontend/ParseNode-inl.h"

Просмотреть файл

@ -139,54 +139,6 @@ js::ExecuteRegExpLegacy(JSContext *cx, RegExpStatics *res, RegExpObject &reobj,
return CreateRegExpMatchResult(cx, input, matches, rval);
}
/* Note: returns the original if no escaping need be performed. */
template <typename CharT>
static bool
EscapeNakedForwardSlashes(StringBuffer &sb, const CharT *oldChars, size_t oldLen)
{
for (const CharT *it = oldChars; it < oldChars + oldLen; ++it) {
if (*it == '/' && (it == oldChars || it[-1] != '\\')) {
/* There's a forward slash that needs escaping. */
if (sb.empty()) {
/* This is the first one we've seen, copy everything up to this point. */
if (mozilla::IsSame<CharT, char16_t>::value && !sb.ensureTwoByteChars())
return false;
if (!sb.reserve(oldLen + 1))
return false;
sb.infallibleAppend(oldChars, size_t(it - oldChars));
}
if (!sb.append('\\'))
return false;
}
if (!sb.empty() && !sb.append(*it))
return false;
}
return true;
}
static JSAtom *
EscapeNakedForwardSlashes(JSContext *cx, JSAtom *unescaped)
{
/* We may never need to use |sb|. Start using it lazily. */
StringBuffer sb(cx);
if (unescaped->hasLatin1Chars()) {
JS::AutoCheckCannotGC nogc;
if (!EscapeNakedForwardSlashes(sb, unescaped->latin1Chars(nogc), unescaped->length()))
return nullptr;
} else {
JS::AutoCheckCannotGC nogc;
if (!EscapeNakedForwardSlashes(sb, unescaped->twoByteChars(nogc), unescaped->length()))
return nullptr;
}
return sb.empty() ? unescaped : sb.finishAtom();
}
/*
* Compile a new |RegExpShared| for the |RegExpObject|.
*
@ -233,29 +185,20 @@ CompileRegExpObject(JSContext *cx, RegExpObjectBuilder &builder, CallArgs args)
}
/*
* Only extract the 'flags' out of sourceObj; do not reuse the
* RegExpShared since it may be from a different compartment.
* Extract the 'source' and the 'flags' out of sourceObj; do not reuse
* the RegExpShared since it may be from a different compartment.
*/
RootedAtom sourceAtom(cx);
RegExpFlag flags;
{
RegExpGuard g(cx);
if (!RegExpToShared(cx, sourceObj, &g))
return false;
sourceAtom = g->getSource();
flags = g->getFlags();
}
/*
* 'toSource' is a permanent read-only property, so this is equivalent
* to executing RegExpObject::getSource on the unwrapped object.
*/
RootedValue v(cx);
if (!GetProperty(cx, sourceObj, sourceObj, cx->names().source, &v))
return false;
// For proxies like CPOWs, we can't assume the result of a property get
// for 'source' is atomized.
Rooted<JSAtom*> sourceAtom(cx, AtomizeString(cx, v.toString()));
RegExpObject *reobj = builder.build(sourceAtom, flags);
if (!reobj)
return false;
@ -284,20 +227,16 @@ CompileRegExpObject(JSContext *cx, RegExpObjectBuilder &builder, CallArgs args)
return false;
}
RootedAtom escapedSourceStr(cx, EscapeNakedForwardSlashes(cx, source));
if (!escapedSourceStr)
return false;
CompileOptions options(cx);
frontend::TokenStream dummyTokenStream(cx, options, nullptr, 0, nullptr);
if (!irregexp::ParsePatternSyntax(dummyTokenStream, cx->tempLifoAlloc(), escapedSourceStr))
if (!irregexp::ParsePatternSyntax(dummyTokenStream, cx->tempLifoAlloc(), source))
return false;
RegExpStatics *res = cx->global()->getRegExpStatics(cx);
if (!res)
return false;
RegExpObject *reobj = builder.build(escapedSourceStr, RegExpFlag(flags | res->getFlags()));
RegExpObject *reobj = builder.build(source, RegExpFlag(flags | res->getFlags()));
if (!reobj)
return false;
@ -431,8 +370,143 @@ regexp_flags(JSContext *cx, unsigned argc, JS::Value *vp)
return true;
}
/* ES6 draft rev32 21.2.5.4. */
MOZ_ALWAYS_INLINE bool
regexp_global_impl(JSContext *cx, CallArgs args)
{
MOZ_ASSERT(IsRegExp(args.thisv()));
Rooted<RegExpObject*> reObj(cx, &args.thisv().toObject().as<RegExpObject>());
/* Steps 4-6. */
args.rval().setBoolean(reObj->global());
return true;
}
static bool
regexp_global(JSContext *cx, unsigned argc, JS::Value *vp)
{
/* Steps 1-3. */
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod<IsRegExp, regexp_global_impl>(cx, args);
}
/* ES6 draft rev32 21.2.5.5. */
MOZ_ALWAYS_INLINE bool
regexp_ignoreCase_impl(JSContext *cx, CallArgs args)
{
MOZ_ASSERT(IsRegExp(args.thisv()));
Rooted<RegExpObject*> reObj(cx, &args.thisv().toObject().as<RegExpObject>());
/* Steps 4-6. */
args.rval().setBoolean(reObj->ignoreCase());
return true;
}
static bool
regexp_ignoreCase(JSContext *cx, unsigned argc, JS::Value *vp)
{
/* Steps 1-3. */
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod<IsRegExp, regexp_ignoreCase_impl>(cx, args);
}
/* ES6 draft rev32 21.2.5.7. */
MOZ_ALWAYS_INLINE bool
regexp_multiline_impl(JSContext *cx, CallArgs args)
{
MOZ_ASSERT(IsRegExp(args.thisv()));
Rooted<RegExpObject*> reObj(cx, &args.thisv().toObject().as<RegExpObject>());
/* Steps 4-6. */
args.rval().setBoolean(reObj->multiline());
return true;
}
static bool
regexp_multiline(JSContext *cx, unsigned argc, JS::Value *vp)
{
/* Steps 1-3. */
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod<IsRegExp, regexp_multiline_impl>(cx, args);
}
/* ES6 draft rev32 21.2.5.10. */
MOZ_ALWAYS_INLINE bool
regexp_source_impl(JSContext *cx, CallArgs args)
{
MOZ_ASSERT(IsRegExp(args.thisv()));
Rooted<RegExpObject*> reObj(cx, &args.thisv().toObject().as<RegExpObject>());
/* Step 5. */
RootedAtom src(cx, reObj->getSource());
if (!src)
return false;
/* Step 7. */
RootedString str(cx, EscapeRegExpPattern(cx, src));
if (!str)
return false;
args.rval().setString(str);
return true;
}
static bool
regexp_source(JSContext *cx, unsigned argc, JS::Value *vp)
{
/* Steps 1-4. */
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod<IsRegExp, regexp_source_impl>(cx, args);
}
/* ES6 draft rev32 21.2.5.12. */
MOZ_ALWAYS_INLINE bool
regexp_sticky_impl(JSContext *cx, CallArgs args)
{
MOZ_ASSERT(IsRegExp(args.thisv()));
Rooted<RegExpObject*> reObj(cx, &args.thisv().toObject().as<RegExpObject>());
/* Steps 4-6. */
args.rval().setBoolean(reObj->sticky());
return true;
}
static bool
regexp_sticky(JSContext *cx, unsigned argc, JS::Value *vp)
{
/* Steps 1-3. */
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod<IsRegExp, regexp_sticky_impl>(cx, args);
}
/* ES6 draft rev32 21.2.5.15. */
MOZ_ALWAYS_INLINE bool
regexp_unicode_impl(JSContext *cx, CallArgs args)
{
MOZ_ASSERT(IsRegExp(args.thisv()));
/* Steps 4-6. */
/* FIXME: When the /u flags is supported, return correct value. */
args.rval().setBoolean(false);
return true;
}
static bool
regexp_unicode(JSContext *cx, unsigned argc, JS::Value *vp)
{
/* Steps 1-3. */
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod<IsRegExp, regexp_unicode_impl>(cx, args);
}
static const JSPropertySpec regexp_properties[] = {
JS_PSG("flags", regexp_flags, 0),
JS_PSG("global", regexp_global, 0),
JS_PSG("ignoreCase", regexp_ignoreCase, 0),
JS_PSG("multiline", regexp_multiline, 0),
JS_PSG("source", regexp_source, 0),
JS_PSG("sticky", regexp_sticky, 0),
JS_PSG("unicode", regexp_unicode, 0),
JS_PS_END
};

Просмотреть файл

@ -540,8 +540,8 @@ EmitLoopEntry(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *nextpn)
}
/*
* If op is JOF_TYPESET (see the type barriers comment in jsinfer.h), reserve
* a type set to store its result.
* If op is JOF_TYPESET (see the type barriers comment in TypeInference.h),
* reserve a type set to store its result.
*/
static inline void
CheckTypeSet(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp op)

Просмотреть файл

@ -15,7 +15,6 @@
#include "js/Conversions.h"
#include "jscntxtinlines.h"
#include "jsinferinlines.h"
#include "jsobjinlines.h"
using namespace js;

Просмотреть файл

@ -416,17 +416,17 @@ class GCSchedulingTunables
* not all bad: minimizing size[allocated] also minimizes the chance of OOM
* and sweeping remains one of the hardest areas to further incrementalize.
*
* MAYBEGC
* -------
* EAGER_ALLOC_TRIGGER
* -------------------
* Occurs when we return to the event loop and find our heap is getting
* largish, but before t[marking] OR t[sweeping] is too large for a
* responsive non-incremental GC. This is intended to be the common case
* in normal web applications: e.g. we just finished an event handler and
* the few objects we allocated when computing the new whatzitz have
* pushed us slightly over the limit. After this GC we rescale the new
* MAYBEGC trigger to 150% of size[retained] so that our non-incremental
* GC times will always be proportional to this size rather than being
* dominated by sweeping.
* EAGER_ALLOC_TRIGGER trigger to 150% of size[retained] so that our
* non-incremental GC times will always be proportional to this size
* rather than being dominated by sweeping.
*
* As a concession to mutators that allocate heavily during their startup
* phase, we have a highFrequencyGCMode that ups the growth rate to 300%
@ -437,6 +437,14 @@ class GCSchedulingTunables
* -> Responsiveness is proportional to t[marking] + t[sweeping].
* -> size[retained] is proportional only to GC allocations.
*
* PERIODIC_FULL_GC
* ----------------
* When we return to the event loop and it has been 20 seconds since we've
* done a GC, we start an incremenal, all-zones, shrinking GC.
*
* Assumptions:
* -> Our triggers are incomplete.
*
* ALLOC_TRIGGER (non-incremental)
* -------------------------------
* If we do not return to the event loop before getting all the way to our
@ -602,7 +610,7 @@ class GCRuntime
gcstats::AutoPhase ap(stats, gcstats::PHASE_EVICT_NURSERY);
minorGCImpl(reason, nullptr);
}
bool gcIfNeeded(JSContext *cx = nullptr);
bool gcIfRequested(JSContext *cx = nullptr);
void gc(JSGCInvocationKind gckind, JS::gcreason::Reason reason);
void startGC(JSGCInvocationKind gckind, JS::gcreason::Reason reason, int64_t millis = 0);
void gcSlice(JS::gcreason::Reason reason, int64_t millis = 0);
@ -732,7 +740,7 @@ class GCRuntime
void setMaxMallocBytes(size_t value);
void resetMallocBytes();
bool isTooMuchMalloc() const { return mallocBytes <= 0; }
bool isTooMuchMalloc() const { return mallocBytesUntilGC <= 0; }
void updateMallocCounter(JS::Zone *zone, size_t nbytes);
void onTooMuchMalloc();
@ -1178,11 +1186,11 @@ class GCRuntime
* Malloc counter to measure memory pressure for GC scheduling. It runs
* from maxMallocBytes down to zero.
*/
mozilla::Atomic<ptrdiff_t, mozilla::ReleaseAcquire> mallocBytes;
mozilla::Atomic<ptrdiff_t, mozilla::ReleaseAcquire> mallocBytesUntilGC;
/*
* Whether a GC has been triggered as a result of mallocBytes falling
* below zero.
* Whether a GC has been triggered as a result of mallocBytesUntilGC
* falling below zero.
*/
mozilla::Atomic<bool, mozilla::ReleaseAcquire> mallocGCTriggered;

Просмотреть файл

@ -22,7 +22,6 @@
#include "vm/UnboxedObject.h"
#include "jscompartmentinlines.h"
#include "jsinferinlines.h"
#include "jsobjinlines.h"
#include "gc/Nursery-inl.h"

Просмотреть файл

@ -11,7 +11,6 @@
#include "jscompartment.h"
#include "jsgc.h"
#include "jsinfer.h"
#include "jsutil.h"
#include "prmjtime.h"
@ -24,6 +23,7 @@
#include "vm/ScopeObject.h"
#endif
#include "vm/TypedArrayObject.h"
#include "vm/TypeInference.h"
#include "jsgcinlines.h"

Просмотреть файл

@ -12,11 +12,11 @@
#include "mozilla/MemoryReporting.h"
#include "jscntxt.h"
#include "jsinfer.h"
#include "gc/FindSCCs.h"
#include "gc/GCRuntime.h"
#include "js/TracingAPI.h"
#include "vm/TypeInference.h"
namespace js {

Просмотреть файл

@ -6,10 +6,10 @@
/* Check the undefined pattern is equivalent to empty string. */
assertEq(RegExp(undefined).source, '');
assertEq(RegExp(undefined).source, '(?:)');
assertEq(RegExp(undefined).global, false);
assertEq("test".replace(RegExp(undefined), "*"), '*test');
assertEq(new RegExp(undefined).source, '');
assertEq(new RegExp(undefined).source, '(?:)');
assertEq(new RegExp(undefined).global, false);
assertEq('test'.replace(new RegExp(undefined), "*"), '*test');

Просмотреть файл

@ -1,6 +1,5 @@
load(libdir + "asserts.js");
var g = newGlobal();
var a = g.RegExp("x");
assertThrowsInstanceOf(function () { Object.defineProperty(a, "ignoreCase", {value: undefined}); },
g.TypeError);
Object.defineProperty(a, "ignoreCase", {value: undefined});
a.toString();

Просмотреть файл

@ -44,7 +44,6 @@
#include "jscompartmentinlines.h"
#include "jsgcinlines.h"
#include "jsinferinlines.h"
#include "jsobjinlines.h"
using namespace js;

Просмотреть файл

@ -16,7 +16,6 @@
#include "jit/Lowering.h"
#include "jit/MIRGraph.h"
#include "jsinferinlines.h"
#include "jsobjinlines.h"
#include "jsopcodeinlines.h"

Просмотреть файл

@ -23,8 +23,6 @@
#include "vm/RegExpStatics.h"
#include "vm/TraceLogging.h"
#include "jsinferinlines.h"
#include "jsobjinlines.h"
#include "jsopcodeinlines.h"
#include "jsscriptinlines.h"

Просмотреть файл

@ -11,7 +11,6 @@
#include "mozilla/MemoryReporting.h"
#include "mozilla/PodOperations.h"
#include "jsinfer.h"
#include "jstypes.h"
#include "gc/Heap.h"
@ -20,6 +19,7 @@
#include "jit/IonTypes.h"
#include "js/UbiNode.h"
#include "vm/TraceLogging.h"
#include "vm/TypeInference.h"
namespace js {

Просмотреть файл

@ -7,7 +7,6 @@
#include "jit/JitFrames-inl.h"
#include "jsfun.h"
#include "jsinfer.h"
#include "jsobj.h"
#include "jsscript.h"
@ -31,13 +30,14 @@
#include "vm/Interpreter.h"
#include "vm/SPSProfiler.h"
#include "vm/TraceLogging.h"
#include "vm/TypeInference.h"
#include "jsinferinlines.h"
#include "jsscriptinlines.h"
#include "gc/Nursery-inl.h"
#include "jit/JitFrameIterator-inl.h"
#include "vm/Debugger-inl.h"
#include "vm/Probes-inl.h"
#include "vm/TypeInference-inl.h"
namespace js {
namespace jit {

Просмотреть файл

@ -7,6 +7,8 @@
#ifndef jit_JitOptions_h
#define jit_JitOptions_h
#include "mozilla/Maybe.h"
#include "jit/IonTypes.h"
#include "js/TypeDecls.h"

Просмотреть файл

@ -13,7 +13,6 @@
#include "jit/MIR.h"
#include "jit/MIRGraph.h"
#include "jsinferinlines.h"
#include "jsobjinlines.h"
#include "jsopcodeinlines.h"

Просмотреть файл

@ -22,7 +22,6 @@
#include "js/Conversions.h"
#include "jsatominlines.h"
#include "jsinferinlines.h"
#include "jsobjinlines.h"
using namespace js;

Просмотреть файл

@ -6,7 +6,6 @@
#include "jit/MacroAssembler.h"
#include "jsinfer.h"
#include "jsprf.h"
#include "builtin/TypedObject.h"
@ -22,7 +21,6 @@
#include "vm/TraceLogging.h"
#include "jsgcinlines.h"
#include "jsinferinlines.h"
#include "jsobjinlines.h"
#include "vm/Interpreter-inl.h"
@ -769,10 +767,17 @@ MacroAssembler::storeUnboxedProperty(T address, JSValueType type,
jump(failure);
}
} else {
if (failure)
branchTestNumber(Assembler::NotEqual, value.reg().valueReg(), failure);
unboxValue(value.reg().valueReg(), AnyRegister(ScratchDoubleReg));
ValueOperand reg = value.reg().valueReg();
Label notInt32, end;
branchTestInt32(Assembler::NotEqual, reg, &notInt32);
int32ValueToDouble(reg, ScratchDoubleReg);
storeDouble(ScratchDoubleReg, address);
jump(&end);
bind(&notInt32);
if (failure)
branchTestDouble(Assembler::NotEqual, reg, failure);
storeValue(reg, address);
bind(&end);
}
break;

Просмотреть файл

@ -9,11 +9,11 @@
#include "mozilla/Maybe.h"
#include "jsinfer.h"
#include "jit/CompactBuffer.h"
#include "jit/CompileInfo.h"
#include "jit/JitAllocPolicy.h"
#include "js/TrackedOptimizationInfo.h"
#include "vm/TypeInference.h"
namespace js {

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше