зеркало из https://github.com/mozilla/gecko-dev.git
Merge m-c to fx-team. a=merge
This commit is contained in:
Коммит
2c3cbbecba
7
CLOBBER
7
CLOBBER
|
@ -22,9 +22,4 @@
|
||||||
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
|
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
|
||||||
# don't change CLOBBER for WebIDL changes any more.
|
# don't change CLOBBER for WebIDL changes any more.
|
||||||
|
|
||||||
Bug 1105308 - Cleanup BluetoothUtils.{cpp,h}
|
Bug 1066383 - Clobber needed due to build system not reliably picking up an IDL removal.
|
||||||
|
|
||||||
This patch set moves some files around and requires a rebuild
|
|
||||||
of the build system's dependency information.
|
|
||||||
|
|
||||||
Merge day clobber
|
|
||||||
|
|
|
@ -262,12 +262,16 @@ function getSdcardPrefix() {
|
||||||
return volumeService.getVolumeByName('sdcard').mountPoint;
|
return volumeService.getVolumeByName('sdcard').mountPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getLogDirectoryRoot() {
|
||||||
|
return 'logs';
|
||||||
|
}
|
||||||
|
|
||||||
function getLogDirectory() {
|
function getLogDirectory() {
|
||||||
let d = new Date();
|
let d = new Date();
|
||||||
d = new Date(d.getTime() - d.getTimezoneOffset() * 60000);
|
d = new Date(d.getTime() - d.getTimezoneOffset() * 60000);
|
||||||
let timestamp = d.toISOString().slice(0, -5).replace(/[:T]/g, '-');
|
let timestamp = d.toISOString().slice(0, -5).replace(/[:T]/g, '-');
|
||||||
// return directory name of format 'logs/timestamp/'
|
// return directory name of format 'logs/timestamp/'
|
||||||
return OS.Path.join('logs', timestamp);
|
return timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -281,9 +285,10 @@ function saveLogs(logArrays) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let sdcardPrefix, dirName;
|
let sdcardPrefix, dirNameRoot, dirName;
|
||||||
try {
|
try {
|
||||||
sdcardPrefix = getSdcardPrefix();
|
sdcardPrefix = getSdcardPrefix();
|
||||||
|
dirNameRoot = getLogDirectoryRoot();
|
||||||
dirName = getLogDirectory();
|
dirName = getLogDirectory();
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
// Return promise failed with exception e
|
// Return promise failed with exception e
|
||||||
|
@ -291,33 +296,39 @@ function saveLogs(logArrays) {
|
||||||
return Promise.reject(e);
|
return Promise.reject(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
debug('making a directory all the way from '+sdcardPrefix+' to '+(sdcardPrefix + '/' + dirName));
|
debug('making a directory all the way from '+sdcardPrefix+' to '+(sdcardPrefix + '/' + dirNameRoot + '/' + dirName));
|
||||||
return OS.File.makeDir(OS.Path.join(sdcardPrefix, dirName), {from: sdcardPrefix})
|
let logsRoot = OS.Path.join(sdcardPrefix, dirNameRoot);
|
||||||
.then(function() {
|
return OS.File.makeDir(logsRoot, {from: sdcardPrefix}).then(
|
||||||
// Now the directory is guaranteed to exist, save the logs
|
function() {
|
||||||
let logFilenames = [];
|
let logsDir = OS.Path.join(logsRoot, dirName);
|
||||||
let saveRequests = [];
|
return OS.File.makeDir(logsDir, {ignoreExisting: false}).then(
|
||||||
|
function() {
|
||||||
|
// Now the directory is guaranteed to exist, save the logs
|
||||||
|
let logFilenames = [];
|
||||||
|
let saveRequests = [];
|
||||||
|
|
||||||
for (let logLocation in logArrays) {
|
for (let logLocation in logArrays) {
|
||||||
debug('requesting save of ' + logLocation);
|
debug('requesting save of ' + logLocation);
|
||||||
let logArray = logArrays[logLocation];
|
let logArray = logArrays[logLocation];
|
||||||
// The filename represents the relative path within the SD card, not the
|
// The filename represents the relative path within the SD card, not the
|
||||||
// absolute path because Gaia will refer to it using the DeviceStorage
|
// absolute path because Gaia will refer to it using the DeviceStorage
|
||||||
// API
|
// API
|
||||||
let filename = OS.Path.join(dirName, getLogFilename(logLocation));
|
let filename = OS.Path.join(dirNameRoot, dirName, getLogFilename(logLocation));
|
||||||
logFilenames.push(filename);
|
logFilenames.push(filename);
|
||||||
let saveRequest = OS.File.writeAtomic(OS.Path.join(sdcardPrefix, filename), logArray);
|
let saveRequest = OS.File.writeAtomic(OS.Path.join(sdcardPrefix, filename), logArray);
|
||||||
saveRequests.push(saveRequest);
|
saveRequests.push(saveRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.all(saveRequests).then(function() {
|
return Promise.all(saveRequests).then(
|
||||||
debug('returning logfilenames: '+logFilenames.toSource());
|
function() {
|
||||||
return {
|
debug('returning logfilenames: '+logFilenames.toSource());
|
||||||
logFilenames: logFilenames,
|
return {
|
||||||
logPrefix: dirName
|
logFilenames: logFilenames,
|
||||||
};
|
logPrefix: OS.Path.join(dirNameRoot, dirName)
|
||||||
|
};
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LogShake.init();
|
LogShake.init();
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
<!--original fetch url was https://git.mozilla.org/releases-->
|
<!--original fetch url was https://git.mozilla.org/releases-->
|
||||||
<remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
|
<remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
|
||||||
<!-- B2G specific things. -->
|
<!-- B2G specific things. -->
|
||||||
<project name="platform_build" path="build" remote="b2g" revision="3ab0d9c70f0b2e1ededc679112c392303f037361">
|
<project name="platform_build" path="build" remote="b2g" revision="e0c735ec89df011ea7dd435087a9045ecff9ff9e">
|
||||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||||
</project>
|
</project>
|
||||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="c5b03a9b40a37947d44a71eccd9017e76632f796"/>
|
<project name="gaia" path="gaia" remote="mozillaorg" revision="c2da2bafd4e809317e2ca70c9bf5c11136a32818"/>
|
||||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="8aee09c106f479f36c57b2a29af72d455e359211"/>
|
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="8aee09c106f479f36c57b2a29af72d455e359211"/>
|
||||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||||
|
@ -113,7 +113,7 @@
|
||||||
<project name="platform/ndk" path="ndk" revision="e58ef003be4306bb53a8c11331146f39e4eab31f"/>
|
<project name="platform/ndk" path="ndk" revision="e58ef003be4306bb53a8c11331146f39e4eab31f"/>
|
||||||
<project name="platform_prebuilts_misc" path="prebuilts/misc" remote="b2g" revision="0e7c060db684b409616fe67ea433ef19f5634c60"/>
|
<project name="platform_prebuilts_misc" path="prebuilts/misc" remote="b2g" revision="0e7c060db684b409616fe67ea433ef19f5634c60"/>
|
||||||
<project name="platform/prebuilts/ndk" path="prebuilts/ndk" revision="c792f0bd9fff7aea2887c60bbb3a9bbdb534ffa3"/>
|
<project name="platform/prebuilts/ndk" path="prebuilts/ndk" revision="c792f0bd9fff7aea2887c60bbb3a9bbdb534ffa3"/>
|
||||||
<project name="platform_prebuilts_qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="c24c8871173bf6aedcf236cab075edf092a7015c"/>
|
<project name="platform_prebuilts_qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="f7d9bf71cf6693474f3f2a81a4ba62c0fc5646aa"/>
|
||||||
<project name="platform/prebuilts/sdk" path="prebuilts/sdk" revision="cfcef469537869947abb9aa1d656774cc2678d4c"/>
|
<project name="platform/prebuilts/sdk" path="prebuilts/sdk" revision="cfcef469537869947abb9aa1d656774cc2678d4c"/>
|
||||||
<project name="platform/prebuilts/tools" path="prebuilts/tools" revision="5a48c04c4bb5f079bc757e29864a42427378e051"/>
|
<project name="platform/prebuilts/tools" path="prebuilts/tools" revision="5a48c04c4bb5f079bc757e29864a42427378e051"/>
|
||||||
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="288db53ad77084bd44791add5e3a4c266a6e9c60"/>
|
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="288db53ad77084bd44791add5e3a4c266a6e9c60"/>
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||||
</project>
|
</project>
|
||||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c5b03a9b40a37947d44a71eccd9017e76632f796"/>
|
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c2da2bafd4e809317e2ca70c9bf5c11136a32818"/>
|
||||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="8aee09c106f479f36c57b2a29af72d455e359211"/>
|
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="8aee09c106f479f36c57b2a29af72d455e359211"/>
|
||||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d5d3f93914558b6f168447b805cd799c8233e300"/>
|
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d5d3f93914558b6f168447b805cd799c8233e300"/>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
</project>
|
</project>
|
||||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="c5b03a9b40a37947d44a71eccd9017e76632f796"/>
|
<project name="gaia" path="gaia" remote="mozillaorg" revision="c2da2bafd4e809317e2ca70c9bf5c11136a32818"/>
|
||||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="8aee09c106f479f36c57b2a29af72d455e359211"/>
|
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="8aee09c106f479f36c57b2a29af72d455e359211"/>
|
||||||
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
|
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
|
||||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f11d3c6500659e3232fbe6fe7ea0204c40ab7fdd"/>
|
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f11d3c6500659e3232fbe6fe7ea0204c40ab7fdd"/>
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
<!--original fetch url was https://git.mozilla.org/releases-->
|
<!--original fetch url was https://git.mozilla.org/releases-->
|
||||||
<remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
|
<remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
|
||||||
<!-- B2G specific things. -->
|
<!-- B2G specific things. -->
|
||||||
<project name="platform_build" path="build" remote="b2g" revision="3ab0d9c70f0b2e1ededc679112c392303f037361">
|
<project name="platform_build" path="build" remote="b2g" revision="e0c735ec89df011ea7dd435087a9045ecff9ff9e">
|
||||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||||
</project>
|
</project>
|
||||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="c5b03a9b40a37947d44a71eccd9017e76632f796"/>
|
<project name="gaia" path="gaia" remote="mozillaorg" revision="c2da2bafd4e809317e2ca70c9bf5c11136a32818"/>
|
||||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="8aee09c106f479f36c57b2a29af72d455e359211"/>
|
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="8aee09c106f479f36c57b2a29af72d455e359211"/>
|
||||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||||
|
@ -113,7 +113,7 @@
|
||||||
<project name="platform/ndk" path="ndk" revision="cb5519af32ae7b4a9c334913a612462ecd04c5d0"/>
|
<project name="platform/ndk" path="ndk" revision="cb5519af32ae7b4a9c334913a612462ecd04c5d0"/>
|
||||||
<project name="platform_prebuilts_misc" path="prebuilts/misc" remote="b2g" revision="0e7c060db684b409616fe67ea433ef19f5634c60"/>
|
<project name="platform_prebuilts_misc" path="prebuilts/misc" remote="b2g" revision="0e7c060db684b409616fe67ea433ef19f5634c60"/>
|
||||||
<project name="platform/prebuilts/ndk" path="prebuilts/ndk" revision="6aa61f8557a22039a30b42b7f283996381fd625d"/>
|
<project name="platform/prebuilts/ndk" path="prebuilts/ndk" revision="6aa61f8557a22039a30b42b7f283996381fd625d"/>
|
||||||
<project name="platform_prebuilts_qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="c24c8871173bf6aedcf236cab075edf092a7015c"/>
|
<project name="platform_prebuilts_qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="f7d9bf71cf6693474f3f2a81a4ba62c0fc5646aa"/>
|
||||||
<project name="platform/prebuilts/sdk" path="prebuilts/sdk" revision="b562b01c93de9578d5db537b6a602a38e1aaa0ce"/>
|
<project name="platform/prebuilts/sdk" path="prebuilts/sdk" revision="b562b01c93de9578d5db537b6a602a38e1aaa0ce"/>
|
||||||
<project name="platform/prebuilts/tools" path="prebuilts/tools" revision="387f03e815f57d536dd922706db1622bddba8d81"/>
|
<project name="platform/prebuilts/tools" path="prebuilts/tools" revision="387f03e815f57d536dd922706db1622bddba8d81"/>
|
||||||
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="288db53ad77084bd44791add5e3a4c266a6e9c60"/>
|
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="288db53ad77084bd44791add5e3a4c266a6e9c60"/>
|
||||||
|
@ -130,7 +130,7 @@
|
||||||
<!-- Emulator specific things -->
|
<!-- Emulator specific things -->
|
||||||
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="72ffdf71c68a96309212eb13d63560d66db14c9e"/>
|
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="72ffdf71c68a96309212eb13d63560d66db14c9e"/>
|
||||||
<project name="device_generic_goldfish" path="device/generic/goldfish" remote="b2g" revision="c0e0019a6ec1a6199a9c7bc4ace041259f3b8512"/>
|
<project name="device_generic_goldfish" path="device/generic/goldfish" remote="b2g" revision="c0e0019a6ec1a6199a9c7bc4ace041259f3b8512"/>
|
||||||
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="615f94d1fb5a75211485a81fcaa8baed7731bfb7"/>
|
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="a510f2d2d579e76421b0c84cd225c249b2da6f8a"/>
|
||||||
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="694cecf256122d0cb3b6a1a4efb4b5c7401db223"/>
|
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="694cecf256122d0cb3b6a1a4efb4b5c7401db223"/>
|
||||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="97d63c256a047b491565d624aea1dd5f1f8593ea"/>
|
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="97d63c256a047b491565d624aea1dd5f1f8593ea"/>
|
||||||
<project name="platform/development" path="development" revision="5968ff4e13e0d696ad8d972281fc27ae5a12829b"/>
|
<project name="platform/development" path="development" revision="5968ff4e13e0d696ad8d972281fc27ae5a12829b"/>
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||||
</project>
|
</project>
|
||||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c5b03a9b40a37947d44a71eccd9017e76632f796"/>
|
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c2da2bafd4e809317e2ca70c9bf5c11136a32818"/>
|
||||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="8aee09c106f479f36c57b2a29af72d455e359211"/>
|
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="8aee09c106f479f36c57b2a29af72d455e359211"/>
|
||||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d5d3f93914558b6f168447b805cd799c8233e300"/>
|
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d5d3f93914558b6f168447b805cd799c8233e300"/>
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
<!--original fetch url was https://git.mozilla.org/releases-->
|
<!--original fetch url was https://git.mozilla.org/releases-->
|
||||||
<remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
|
<remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
|
||||||
<!-- B2G specific things. -->
|
<!-- B2G specific things. -->
|
||||||
<project name="platform_build" path="build" remote="b2g" revision="3ab0d9c70f0b2e1ededc679112c392303f037361">
|
<project name="platform_build" path="build" remote="b2g" revision="e0c735ec89df011ea7dd435087a9045ecff9ff9e">
|
||||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||||
</project>
|
</project>
|
||||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="c5b03a9b40a37947d44a71eccd9017e76632f796"/>
|
<project name="gaia" path="gaia" remote="mozillaorg" revision="c2da2bafd4e809317e2ca70c9bf5c11136a32818"/>
|
||||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="8aee09c106f479f36c57b2a29af72d455e359211"/>
|
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="8aee09c106f479f36c57b2a29af72d455e359211"/>
|
||||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||||
|
@ -113,7 +113,7 @@
|
||||||
<project name="platform/ndk" path="ndk" revision="e58ef003be4306bb53a8c11331146f39e4eab31f"/>
|
<project name="platform/ndk" path="ndk" revision="e58ef003be4306bb53a8c11331146f39e4eab31f"/>
|
||||||
<project name="platform_prebuilts_misc" path="prebuilts/misc" remote="b2g" revision="0e7c060db684b409616fe67ea433ef19f5634c60"/>
|
<project name="platform_prebuilts_misc" path="prebuilts/misc" remote="b2g" revision="0e7c060db684b409616fe67ea433ef19f5634c60"/>
|
||||||
<project name="platform/prebuilts/ndk" path="prebuilts/ndk" revision="c792f0bd9fff7aea2887c60bbb3a9bbdb534ffa3"/>
|
<project name="platform/prebuilts/ndk" path="prebuilts/ndk" revision="c792f0bd9fff7aea2887c60bbb3a9bbdb534ffa3"/>
|
||||||
<project name="platform_prebuilts_qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="c24c8871173bf6aedcf236cab075edf092a7015c"/>
|
<project name="platform_prebuilts_qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="f7d9bf71cf6693474f3f2a81a4ba62c0fc5646aa"/>
|
||||||
<project name="platform/prebuilts/sdk" path="prebuilts/sdk" revision="69d524e80cdf3981006627c65ac85f3a871238a3"/>
|
<project name="platform/prebuilts/sdk" path="prebuilts/sdk" revision="69d524e80cdf3981006627c65ac85f3a871238a3"/>
|
||||||
<project name="platform/prebuilts/tools" path="prebuilts/tools" revision="5a48c04c4bb5f079bc757e29864a42427378e051"/>
|
<project name="platform/prebuilts/tools" path="prebuilts/tools" revision="5a48c04c4bb5f079bc757e29864a42427378e051"/>
|
||||||
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="288db53ad77084bd44791add5e3a4c266a6e9c60"/>
|
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="288db53ad77084bd44791add5e3a4c266a6e9c60"/>
|
||||||
|
@ -137,9 +137,11 @@
|
||||||
<!-- Flame specific things -->
|
<!-- Flame specific things -->
|
||||||
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="1bb28abbc215f45220620af5cd60a8ac1be93722"/>
|
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="1bb28abbc215f45220620af5cd60a8ac1be93722"/>
|
||||||
<project name="device/qcom/common" path="device/qcom/common" revision="54c32c2ddef066fbdf611d29e4b7c47e0363599e"/>
|
<project name="device/qcom/common" path="device/qcom/common" revision="54c32c2ddef066fbdf611d29e4b7c47e0363599e"/>
|
||||||
<project name="device-flame" path="device/t2m/flame" remote="b2g" revision="e5c6b275d77ca95fb0f2051c3d2242e6e0d0e442"/>
|
<project name="device-flame" path="device/t2m/flame" remote="b2g" revision="a814b2e2dfdda7140cb3a357617dc4fbb1435e76"/>
|
||||||
<project name="codeaurora_kernel_msm" path="kernel" remote="b2g" revision="48b6a2c9fde18f2f7d9abddf05261c498c2bb2ba"/>
|
<project name="codeaurora_kernel_msm" path="kernel" remote="b2g" revision="48b6a2c9fde18f2f7d9abddf05261c498c2bb2ba"/>
|
||||||
<project name="kernel_lk" path="bootable/bootloader/lk" remote="b2g" revision="fda40423ffa573dc6cafd3780515010cb2a086be"/>
|
<project name="kernel_lk" path="bootable/bootloader/lk" remote="b2g" revision="fda40423ffa573dc6cafd3780515010cb2a086be"/>
|
||||||
|
<remove-project name="platform/bootable/recovery"/>
|
||||||
|
<project name="platform_bootable_recovery" path="bootable/recovery" remote="b2g" revision="26e78a979f3090dc196219e268467620b6c40ec5"/>
|
||||||
<project name="platform/external/bluetooth/bluedroid" path="external/bluetooth/bluedroid" revision="30b96dfca99cb384bf520a16b81f3aba56f09907"/>
|
<project name="platform/external/bluetooth/bluedroid" path="external/bluetooth/bluedroid" revision="30b96dfca99cb384bf520a16b81f3aba56f09907"/>
|
||||||
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="5b71e40213f650459e95d35b6f14af7e88d8ab62"/>
|
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="5b71e40213f650459e95d35b6f14af7e88d8ab62"/>
|
||||||
<project name="platform_external_libnfc-nci" path="external/libnfc-nci" remote="t2m" revision="4186bdecb4dae911b39a8202252cc2310d91b0be"/>
|
<project name="platform_external_libnfc-nci" path="external/libnfc-nci" remote="t2m" revision="4186bdecb4dae911b39a8202252cc2310d91b0be"/>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
</project>
|
</project>
|
||||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="c5b03a9b40a37947d44a71eccd9017e76632f796"/>
|
<project name="gaia" path="gaia" remote="mozillaorg" revision="c2da2bafd4e809317e2ca70c9bf5c11136a32818"/>
|
||||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="8aee09c106f479f36c57b2a29af72d455e359211"/>
|
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="8aee09c106f479f36c57b2a29af72d455e359211"/>
|
||||||
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
|
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
|
||||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f11d3c6500659e3232fbe6fe7ea0204c40ab7fdd"/>
|
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f11d3c6500659e3232fbe6fe7ea0204c40ab7fdd"/>
|
||||||
|
|
|
@ -4,6 +4,6 @@
|
||||||
"remote": "",
|
"remote": "",
|
||||||
"branch": ""
|
"branch": ""
|
||||||
},
|
},
|
||||||
"revision": "24f27472ae6ddb6c819227cb3b7d398a6925ef86",
|
"revision": "b60aedd37a5ccdb71893d31761988bcc17a82676",
|
||||||
"repo_path": "integration/gaia-central"
|
"repo_path": "integration/gaia-central"
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||||
</project>
|
</project>
|
||||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c5b03a9b40a37947d44a71eccd9017e76632f796"/>
|
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c2da2bafd4e809317e2ca70c9bf5c11136a32818"/>
|
||||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="8aee09c106f479f36c57b2a29af72d455e359211"/>
|
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="8aee09c106f479f36c57b2a29af72d455e359211"/>
|
||||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||||
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
|
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||||
</project>
|
</project>
|
||||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c5b03a9b40a37947d44a71eccd9017e76632f796"/>
|
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c2da2bafd4e809317e2ca70c9bf5c11136a32818"/>
|
||||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="8aee09c106f479f36c57b2a29af72d455e359211"/>
|
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="8aee09c106f479f36c57b2a29af72d455e359211"/>
|
||||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
</project>
|
</project>
|
||||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="c5b03a9b40a37947d44a71eccd9017e76632f796"/>
|
<project name="gaia" path="gaia" remote="mozillaorg" revision="c2da2bafd4e809317e2ca70c9bf5c11136a32818"/>
|
||||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="8aee09c106f479f36c57b2a29af72d455e359211"/>
|
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="8aee09c106f479f36c57b2a29af72d455e359211"/>
|
||||||
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
|
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
|
||||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f11d3c6500659e3232fbe6fe7ea0204c40ab7fdd"/>
|
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f11d3c6500659e3232fbe6fe7ea0204c40ab7fdd"/>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||||
</project>
|
</project>
|
||||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c5b03a9b40a37947d44a71eccd9017e76632f796"/>
|
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c2da2bafd4e809317e2ca70c9bf5c11136a32818"/>
|
||||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="8aee09c106f479f36c57b2a29af72d455e359211"/>
|
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="8aee09c106f479f36c57b2a29af72d455e359211"/>
|
||||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||||
|
|
|
@ -401,6 +401,8 @@
|
||||||
@BINPATH@/components/nsSidebar.js
|
@BINPATH@/components/nsSidebar.js
|
||||||
@BINPATH@/components/nsAsyncShutdown.manifest
|
@BINPATH@/components/nsAsyncShutdown.manifest
|
||||||
@BINPATH@/components/nsAsyncShutdown.js
|
@BINPATH@/components/nsAsyncShutdown.js
|
||||||
|
@BINPATH@/components/htmlMenuBuilder.js
|
||||||
|
@BINPATH@/components/htmlMenuBuilder.manifest
|
||||||
|
|
||||||
; WiFi, NetworkManager, NetworkStats
|
; WiFi, NetworkManager, NetworkStats
|
||||||
#ifdef MOZ_WIDGET_GONK
|
#ifdef MOZ_WIDGET_GONK
|
||||||
|
|
|
@ -259,10 +259,10 @@ XPCOMUtils.defineLazyServiceGetter(this, "gCrashReporter",
|
||||||
"nsICrashReporter");
|
"nsICrashReporter");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
XPCOMUtils.defineLazyGetter(this, "PageMenu", function() {
|
XPCOMUtils.defineLazyGetter(this, "PageMenuParent", function() {
|
||||||
let tmp = {};
|
let tmp = {};
|
||||||
Cu.import("resource://gre/modules/PageMenu.jsm", tmp);
|
Cu.import("resource://gre/modules/PageMenu.jsm", tmp);
|
||||||
return new tmp.PageMenu();
|
return new tmp.PageMenuParent();
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -43,6 +43,11 @@ XPCOMUtils.defineLazyGetter(this, "SimpleServiceDiscovery", function() {
|
||||||
});
|
});
|
||||||
return ssdp;
|
return ssdp;
|
||||||
});
|
});
|
||||||
|
XPCOMUtils.defineLazyGetter(this, "PageMenuChild", function() {
|
||||||
|
let tmp = {};
|
||||||
|
Cu.import("resource://gre/modules/PageMenu.jsm", tmp);
|
||||||
|
return new tmp.PageMenuChild();
|
||||||
|
});
|
||||||
|
|
||||||
// TabChildGlobal
|
// TabChildGlobal
|
||||||
var global = this;
|
var global = this;
|
||||||
|
@ -102,6 +107,10 @@ addMessageListener("SecondScreen:tab-mirror", function(message) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
addMessageListener("ContextMenu:DoCustomCommand", function(message) {
|
||||||
|
PageMenuChild.executeMenu(message.data);
|
||||||
|
});
|
||||||
|
|
||||||
addEventListener("DOMFormHasPassword", function(event) {
|
addEventListener("DOMFormHasPassword", function(event) {
|
||||||
InsecurePasswordUtils.checkForInsecurePasswords(event.target);
|
InsecurePasswordUtils.checkForInsecurePasswords(event.target);
|
||||||
LoginManagerContent.onFormPassword(event);
|
LoginManagerContent.onFormPassword(event);
|
||||||
|
@ -148,7 +157,8 @@ let handleContentContextMenu = function (event) {
|
||||||
InlineSpellCheckerContent.initContextMenu(event, editFlags, this);
|
InlineSpellCheckerContent.initContextMenu(event, editFlags, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
sendSyncMessage("contextmenu", { editFlags, spellInfo, addonInfo }, { event, popupNode: event.target });
|
let customMenuItems = PageMenuChild.build(event.target);
|
||||||
|
sendSyncMessage("contextmenu", { editFlags, spellInfo, customMenuItems, addonInfo }, { event, popupNode: event.target });
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Break out to the parent window and pass the add-on info along
|
// Break out to the parent window and pass the add-on info along
|
||||||
|
|
|
@ -24,10 +24,15 @@ nsContextMenu.prototype = {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.hasPageMenu = false;
|
this.hasPageMenu = false;
|
||||||
// FIXME (bug 1047751) - The page menu is disabled in e10s.
|
if (!aIsShift) {
|
||||||
if (!aIsShift && !this.isRemote) {
|
if (this.isRemote) {
|
||||||
this.hasPageMenu = PageMenu.maybeBuildAndAttachMenu(this.target,
|
this.hasPageMenu =
|
||||||
aXulMenu);
|
PageMenuParent.addToPopup(gContextMenuContentData.customMenuItems,
|
||||||
|
this.browser, aXulMenu);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.hasPageMenu = PageMenuParent.buildAndAddToPopup(this.target, aXulMenu);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isFrameImage = document.getElementById("isFrameImage");
|
this.isFrameImage = document.getElementById("isFrameImage");
|
||||||
|
@ -1766,7 +1771,7 @@ nsContextMenu.prototype = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if this is a page menu item:
|
// Check if this is a page menu item:
|
||||||
if (e.target.hasAttribute(PageMenu.GENERATEDITEMID_ATTR)) {
|
if (e.target.hasAttribute(PageMenuParent.GENERATEDITEMID_ATTR)) {
|
||||||
this._telemetryClickID = "custom-page-item";
|
this._telemetryClickID = "custom-page-item";
|
||||||
} else {
|
} else {
|
||||||
this._telemetryClickID = (e.target.id || "unknown").replace(/^context-/i, "");
|
this._telemetryClickID = (e.target.id || "unknown").replace(/^context-/i, "");
|
||||||
|
|
|
@ -3175,6 +3175,7 @@
|
||||||
browser: browser,
|
browser: browser,
|
||||||
editFlags: aMessage.data.editFlags,
|
editFlags: aMessage.data.editFlags,
|
||||||
spellInfo: spellInfo,
|
spellInfo: spellInfo,
|
||||||
|
customMenuItems: aMessage.data.customMenuItems,
|
||||||
addonInfo: aMessage.data.addonInfo };
|
addonInfo: aMessage.data.addonInfo };
|
||||||
let popup = browser.ownerDocument.getElementById("contentAreaContextMenu");
|
let popup = browser.ownerDocument.getElementById("contentAreaContextMenu");
|
||||||
let event = gContextMenuContentData.event;
|
let event = gContextMenuContentData.event;
|
||||||
|
|
|
@ -72,6 +72,7 @@ support-files =
|
||||||
redirect_bug623155.sjs
|
redirect_bug623155.sjs
|
||||||
searchSuggestionEngine.sjs
|
searchSuggestionEngine.sjs
|
||||||
searchSuggestionEngine.xml
|
searchSuggestionEngine.xml
|
||||||
|
subtst_contextmenu.html
|
||||||
test-mixedcontent-securityerrors.html
|
test-mixedcontent-securityerrors.html
|
||||||
test_bug435035.html
|
test_bug435035.html
|
||||||
test_bug462673.html
|
test_bug462673.html
|
||||||
|
@ -486,4 +487,5 @@ skip-if = e10s # bug 1100687 - test directly manipulates content (content.docume
|
||||||
[browser_mcb_redirect.js]
|
[browser_mcb_redirect.js]
|
||||||
skip-if = e10s # bug 1084504 - [e10s] Mixed content detection does not take redirection into account
|
skip-if = e10s # bug 1084504 - [e10s] Mixed content detection does not take redirection into account
|
||||||
[browser_windowactivation.js]
|
[browser_windowactivation.js]
|
||||||
|
[browser_contextmenu_childprocess.js]
|
||||||
[browser_bug963945.js]
|
[browser_bug963945.js]
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
const gBaseURL = "https://example.com/browser/browser/base/content/test/general/";
|
||||||
|
|
||||||
|
add_task(function *() {
|
||||||
|
let tab = gBrowser.addTab();
|
||||||
|
let browser = gBrowser.getBrowserForTab(tab);
|
||||||
|
|
||||||
|
gBrowser.selectedTab = tab;
|
||||||
|
yield promiseTabLoadEvent(tab, gBaseURL + "subtst_contextmenu.html");
|
||||||
|
|
||||||
|
let popupShownPromise = promiseWaitForEvent(window, "popupshown", true);
|
||||||
|
|
||||||
|
// Get the point of the element with the page menu (test-pagemenu) and
|
||||||
|
// synthesize a right mouse click there.
|
||||||
|
let eventDetails = { type : "contextmenu", button : 2 };
|
||||||
|
let rect = browser.contentWindow.document.getElementById("test-pagemenu").getBoundingClientRect();
|
||||||
|
EventUtils.synthesizeMouse(browser, rect.x + rect.width / 2, rect.y + rect.height / 2, eventDetails, window);
|
||||||
|
|
||||||
|
let event = yield popupShownPromise;
|
||||||
|
|
||||||
|
let contextMenu = document.getElementById("contentAreaContextMenu");
|
||||||
|
checkMenu(contextMenu);
|
||||||
|
contextMenu.hidePopup();
|
||||||
|
gBrowser.removeCurrentTab();
|
||||||
|
});
|
||||||
|
|
||||||
|
function checkItems(menuitem, arr)
|
||||||
|
{
|
||||||
|
for (let i = 0; i < arr.length; i += 2) {
|
||||||
|
let str = arr[i];
|
||||||
|
let details = arr[i + 1];
|
||||||
|
if (str == "---") {
|
||||||
|
is(menuitem.localName, "menuseparator", "menuseparator");
|
||||||
|
}
|
||||||
|
else if ("children" in details) {
|
||||||
|
is(menuitem.localName, "menu", "submenu");
|
||||||
|
is(menuitem.getAttribute("label"), str, str + " label");
|
||||||
|
checkItems(menuitem.firstChild.firstChild, details.children);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
is(menuitem.localName, "menuitem", str + " menuitem");
|
||||||
|
|
||||||
|
is(menuitem.getAttribute("label"), str, str + " label");
|
||||||
|
is(menuitem.getAttribute("type"), details.type, str + " type");
|
||||||
|
is(menuitem.getAttribute("image"), details.icon ? gBaseURL + details.icon : "", str + " icon");
|
||||||
|
|
||||||
|
if (details.checked)
|
||||||
|
is(menuitem.getAttribute("checked"), "true", str + " checked");
|
||||||
|
else
|
||||||
|
ok(!menuitem.hasAttribute("checked"), str + " checked");
|
||||||
|
|
||||||
|
if (details.disabled)
|
||||||
|
is(menuitem.getAttribute("disabled"), "true", str + " disabled");
|
||||||
|
else
|
||||||
|
ok(!menuitem.hasAttribute("disabled"), str + " disabled");
|
||||||
|
}
|
||||||
|
|
||||||
|
menuitem = menuitem.nextSibling;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkMenu(contextMenu)
|
||||||
|
{
|
||||||
|
let items = [ "Plain item", {type: "", icon: "", checked: false, disabled: false},
|
||||||
|
"Disabled item", {type: "", icon: "", checked: false, disabled: true},
|
||||||
|
"Item w/ textContent", {type: "", icon: "", checked: false, disabled: false},
|
||||||
|
"---", null,
|
||||||
|
"Checkbox", {type: "checkbox", icon: "", checked: true, disabled: false},
|
||||||
|
"---", null,
|
||||||
|
"Radio1", {type: "checkbox", icon: "", checked: true, disabled: false},
|
||||||
|
"Radio2", {type: "checkbox", icon: "", checked: false, disabled: false},
|
||||||
|
"Radio3", {type: "checkbox", icon: "", checked: false, disabled: false},
|
||||||
|
"---", null,
|
||||||
|
"Item w/ icon", {type: "", icon: "favicon.ico", checked: false, disabled: false},
|
||||||
|
"Item w/ bad icon", {type: "", icon: "", checked: false, disabled: false},
|
||||||
|
"---", null,
|
||||||
|
"Submenu", { children:
|
||||||
|
["Radio1", {type: "checkbox", icon: "", checked: false, disabled: false},
|
||||||
|
"Radio2", {type: "checkbox", icon: "", checked: true, disabled: false},
|
||||||
|
"Radio3", {type: "checkbox", icon: "", checked: false, disabled: false},
|
||||||
|
"---", null,
|
||||||
|
"Checkbox", {type: "checkbox", icon: "", checked: false, disabled: false}] }
|
||||||
|
];
|
||||||
|
checkItems(contextMenu.childNodes[2], items);
|
||||||
|
}
|
|
@ -495,7 +495,7 @@ function runTest(testNum) {
|
||||||
"context-viewinfo", true
|
"context-viewinfo", true
|
||||||
].concat(inspectItems));
|
].concat(inspectItems));
|
||||||
|
|
||||||
invokeItemAction("0");
|
invokeItemAction("1");
|
||||||
closeContextMenu();
|
closeContextMenu();
|
||||||
|
|
||||||
// run mozRequestFullScreen on the element we're testing
|
// run mozRequestFullScreen on the element we're testing
|
||||||
|
|
|
@ -542,6 +542,8 @@
|
||||||
@RESPATH@/components/Identity.manifest
|
@RESPATH@/components/Identity.manifest
|
||||||
@RESPATH@/components/recording-cmdline.js
|
@RESPATH@/components/recording-cmdline.js
|
||||||
@RESPATH@/components/recording-cmdline.manifest
|
@RESPATH@/components/recording-cmdline.manifest
|
||||||
|
@RESPATH@/components/htmlMenuBuilder.js
|
||||||
|
@RESPATH@/components/htmlMenuBuilder.manifest
|
||||||
|
|
||||||
@RESPATH@/components/PermissionSettings.js
|
@RESPATH@/components/PermissionSettings.js
|
||||||
@RESPATH@/components/PermissionSettings.manifest
|
@RESPATH@/components/PermissionSettings.manifest
|
||||||
|
|
|
@ -77,7 +77,7 @@ SEARCHPLUGINS_PATH := $(FINAL_TARGET)/searchplugins
|
||||||
# metro build call a searchplugins target for search engine plugins
|
# metro build call a searchplugins target for search engine plugins
|
||||||
.PHONY: searchplugins
|
.PHONY: searchplugins
|
||||||
SEARCHPLUGINS_TARGET := libs searchplugins
|
SEARCHPLUGINS_TARGET := libs searchplugins
|
||||||
SEARCHPLUGINS := $(foreach plugin,$(addsuffix .xml,$(SEARCHPLUGINS_NAMES)),$(or $(wildcard $(call MERGE_FILE,searchplugins/$(plugin))),$(info Missing searchplugin: $(plugin))))
|
SEARCHPLUGINS := $(foreach plugin,$(addsuffix .xml,$(SEARCHPLUGINS_NAMES)),$(or $(wildcard $(call EN_US_OR_L10N_FILE,searchplugins/$(plugin))),$(info Missing searchplugin: $(plugin))))
|
||||||
# Some locale-specific search plugins may have preprocessor directives, but the
|
# Some locale-specific search plugins may have preprocessor directives, but the
|
||||||
# default en-US ones do not.
|
# default en-US ones do not.
|
||||||
SEARCHPLUGINS_FLAGS := --silence-missing-directive-warnings
|
SEARCHPLUGINS_FLAGS := --silence-missing-directive-warnings
|
||||||
|
|
|
@ -614,6 +614,13 @@ MERGE_FILE = $(LOCALE_SRCDIR)/$(1)
|
||||||
endif
|
endif
|
||||||
MERGE_FILES = $(foreach f,$(1),$(call MERGE_FILE,$(f)))
|
MERGE_FILES = $(foreach f,$(1),$(call MERGE_FILE,$(f)))
|
||||||
|
|
||||||
|
# These marcros are similar to MERGE_FILE, but no merging, and en-US first.
|
||||||
|
# They're used for searchplugins, for example.
|
||||||
|
EN_US_OR_L10N_FILE = $(firstword \
|
||||||
|
$(wildcard $(srcdir)/en-US/$(1)) \
|
||||||
|
$(LOCALE_SRCDIR)/$(1) )
|
||||||
|
EN_US_OR_L10N_FILES = $(foreach f,$(1),$(call EN_US_OR_L10N_FILE,$(f)))
|
||||||
|
|
||||||
ifneq (WINNT,$(OS_ARCH))
|
ifneq (WINNT,$(OS_ARCH))
|
||||||
RUN_TEST_PROGRAM = $(LIBXUL_DIST)/bin/run-mozilla.sh
|
RUN_TEST_PROGRAM = $(LIBXUL_DIST)/bin/run-mozilla.sh
|
||||||
endif # ! WINNT
|
endif # ! WINNT
|
||||||
|
|
|
@ -22,48 +22,39 @@ include $(topsrcdir)/config/rules.mk
|
||||||
# As an optimization to reduce overall CPU usage, we process all .idl
|
# As an optimization to reduce overall CPU usage, we process all .idl
|
||||||
# belonging to a module with a single command invocation. This prevents
|
# belonging to a module with a single command invocation. This prevents
|
||||||
# redundant parsing of .idl files and significantly reduces CPU cycles.
|
# redundant parsing of .idl files and significantly reduces CPU cycles.
|
||||||
#
|
|
||||||
# Future improvement: Headers are currently written to a local directory then
|
|
||||||
# installed in the distribution directory. It is preferable to write headers
|
|
||||||
# directly into the distribution directory. However, PGO builds remove the dist
|
|
||||||
# directory via rm -rf (with no regards to manifests). Since the cost of
|
|
||||||
# processing XPIDL files is not trivial, it is preferrable to cache the headers
|
|
||||||
# and reinstall them rather than regenerate them. Ideally the dist pruning is
|
|
||||||
# performed with manifests. At that time we can write headers directly to the
|
|
||||||
# dist directory.
|
|
||||||
|
|
||||||
# For dependency files.
|
# For dependency files.
|
||||||
idl_deps_dir := .deps
|
idl_deps_dir := .deps
|
||||||
|
|
||||||
# Where we put our final, linked .xpt files.
|
|
||||||
idl_xpt_dir := xpt
|
|
||||||
|
|
||||||
dist_idl_dir := $(DIST)/idl
|
dist_idl_dir := $(DIST)/idl
|
||||||
dist_include_dir := $(DIST)/include
|
dist_include_dir := $(DIST)/include
|
||||||
process_py := $(topsrcdir)/python/mozbuild/mozbuild/action/xpidl-process.py
|
process_py := $(topsrcdir)/python/mozbuild/mozbuild/action/xpidl-process.py
|
||||||
|
|
||||||
# TODO we should use py_action, but that would require extra directories to be
|
|
||||||
# in the virtualenv.
|
|
||||||
idlprocess := $(PYTHON_PATH) $(PLY_INCLUDE) -I$(IDL_PARSER_DIR) -I$(IDL_PARSER_CACHE_DIR) \
|
|
||||||
$(process_py) --cache-dir $(IDL_PARSER_CACHE_DIR) $(dist_idl_dir) \
|
|
||||||
$(dist_include_dir) $(idl_xpt_dir) $(idl_deps_dir)
|
|
||||||
|
|
||||||
ifdef LIBXUL_SDK
|
ifdef LIBXUL_SDK
|
||||||
idlprocess += -I$(LIBXUL_SDK)/idl
|
libxul_sdk_includes := -I$(LIBXUL_SDK)/idl
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# TODO we should use py_action, but that would require extra directories to be
|
||||||
|
# in the virtualenv.
|
||||||
|
%.xpt:
|
||||||
|
@echo "$(@F)"
|
||||||
|
$(PYTHON_PATH) $(PLY_INCLUDE) -I$(IDL_PARSER_DIR) -I$(IDL_PARSER_CACHE_DIR) \
|
||||||
|
$(process_py) --cache-dir $(IDL_PARSER_CACHE_DIR) $(dist_idl_dir) \
|
||||||
|
$(dist_include_dir) $(@D) $(idl_deps_dir) $(libxul_sdk_includes) \
|
||||||
|
$(basename $(notdir $@ $(filter %.idl,$^)))
|
||||||
|
|
||||||
xpidl_modules := @xpidl_modules@
|
xpidl_modules := @xpidl_modules@
|
||||||
|
xpt_files := @xpt_files@
|
||||||
|
|
||||||
@xpidl_rules@
|
@xpidl_rules@
|
||||||
|
|
||||||
linked_xpt_files := $(addprefix $(idl_xpt_dir)/,$(addsuffix .xpt,$(xpidl_modules)))
|
|
||||||
depends_files := $(foreach root,$(xpidl_modules),$(idl_deps_dir)/$(root).pp)
|
depends_files := $(foreach root,$(xpidl_modules),$(idl_deps_dir)/$(root).pp)
|
||||||
|
|
||||||
GARBAGE += $(linked_xpt_files) $(depends_files)
|
GARBAGE += $(xpt_files) $(depends_files)
|
||||||
|
|
||||||
xpidl:: $(linked_xpt_files)
|
xpidl:: $(xpt_files)
|
||||||
|
|
||||||
$(linked_xpt_files): $(process_py) $(call mkdir_deps,$(idl_deps_dir) $(dist_include_dir) $(idl_xpt_dir))
|
$(xpt_files): $(process_py) $(call mkdir_deps,$(idl_deps_dir) $(dist_include_dir))
|
||||||
|
|
||||||
$(call include_deps,$(depends_files))
|
$(call include_deps,$(depends_files))
|
||||||
|
|
||||||
|
|
|
@ -1157,11 +1157,6 @@ endif
|
||||||
ifdef XPT_NAME #{
|
ifdef XPT_NAME #{
|
||||||
|
|
||||||
ifndef NO_DIST_INSTALL
|
ifndef NO_DIST_INSTALL
|
||||||
_XPT_NAME_FILES := $(DEPTH)/config/makefiles/xpidl/xpt/$(XPT_NAME)
|
|
||||||
_XPT_NAME_DEST := $(FINAL_TARGET)/components
|
|
||||||
_XPT_NAME_TARGET := misc
|
|
||||||
INSTALL_TARGETS += _XPT_NAME
|
|
||||||
|
|
||||||
ifndef NO_INTERFACES_MANIFEST
|
ifndef NO_INTERFACES_MANIFEST
|
||||||
misc:: $(call mkdir_deps,$(FINAL_TARGET)/components)
|
misc:: $(call mkdir_deps,$(FINAL_TARGET)/components)
|
||||||
$(call py_action,buildlist,$(FINAL_TARGET)/components/interfaces.manifest 'interfaces $(XPT_NAME)')
|
$(call py_action,buildlist,$(FINAL_TARGET)/components/interfaces.manifest 'interfaces $(XPT_NAME)')
|
||||||
|
|
|
@ -286,6 +286,7 @@ if test -n "$gonkdir" ; then
|
||||||
21)
|
21)
|
||||||
GONK_INCLUDES="-I$gonkdir/frameworks/native/include -I$gonkdir/frameworks/av/include -I$gonkdir/frameworks/av/include/media -I$gonkdir/frameworks/av/include/camera -I$gonkdir/frameworks/native/include/media/openmax -I$gonkdir/frameworks/av/media/libstagefright/include"
|
GONK_INCLUDES="-I$gonkdir/frameworks/native/include -I$gonkdir/frameworks/av/include -I$gonkdir/frameworks/av/include/media -I$gonkdir/frameworks/av/include/camera -I$gonkdir/frameworks/native/include/media/openmax -I$gonkdir/frameworks/av/media/libstagefright/include"
|
||||||
MOZ_AUDIO_OFFLOAD=1
|
MOZ_AUDIO_OFFLOAD=1
|
||||||
|
MOZ_OMX_DECODER=1
|
||||||
AC_SUBST(MOZ_AUDIO_OFFLOAD)
|
AC_SUBST(MOZ_AUDIO_OFFLOAD)
|
||||||
AC_DEFINE(MOZ_AUDIO_OFFLOAD)
|
AC_DEFINE(MOZ_AUDIO_OFFLOAD)
|
||||||
MOZ_FMP4=
|
MOZ_FMP4=
|
||||||
|
|
|
@ -819,7 +819,12 @@ NotifyOffThreadScriptLoadCompletedRunnable::Run()
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
nsresult rv = mLoader->ProcessOffThreadRequest(mRequest, &mToken);
|
// We want these to be dropped on the main thread, once we return from this
|
||||||
|
// function.
|
||||||
|
nsRefPtr<nsScriptLoadRequest> request = mRequest.forget();
|
||||||
|
nsRefPtr<nsScriptLoader> loader = mLoader.forget();
|
||||||
|
|
||||||
|
nsresult rv = loader->ProcessOffThreadRequest(request, &mToken);
|
||||||
|
|
||||||
if (mToken) {
|
if (mToken) {
|
||||||
// The result of the off thread parse was not actually needed to process
|
// The result of the off thread parse was not actually needed to process
|
||||||
|
|
|
@ -101,13 +101,6 @@ MobileConnectionListener::NotifyDataChanged()
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
MobileConnectionListener::NotifyUssdReceived(const nsAString & message,
|
|
||||||
bool sessionEnded)
|
|
||||||
{
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
MobileConnectionListener::NotifyDataError(const nsAString & message)
|
MobileConnectionListener::NotifyDataError(const nsAString & message)
|
||||||
{
|
{
|
||||||
|
|
|
@ -101,13 +101,6 @@ MobileConnectionListener::NotifyDataChanged()
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
MobileConnectionListener::NotifyUssdReceived(const nsAString & message,
|
|
||||||
bool sessionEnded)
|
|
||||||
{
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
MobileConnectionListener::NotifyDataError(const nsAString & message)
|
MobileConnectionListener::NotifyDataError(const nsAString & message)
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,11 +9,13 @@
|
||||||
#include "mozilla/EventDispatcher.h"
|
#include "mozilla/EventDispatcher.h"
|
||||||
#include "mozilla/dom/HTMLMenuElementBinding.h"
|
#include "mozilla/dom/HTMLMenuElementBinding.h"
|
||||||
#include "mozilla/dom/HTMLMenuItemElement.h"
|
#include "mozilla/dom/HTMLMenuItemElement.h"
|
||||||
|
#include "nsIMenuBuilder.h"
|
||||||
#include "nsAttrValueInlines.h"
|
#include "nsAttrValueInlines.h"
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
#include "nsXULContextMenuBuilder.h"
|
|
||||||
#include "nsIURI.h"
|
#include "nsIURI.h"
|
||||||
|
|
||||||
|
#define HTMLMENUBUILDER_CONTRACTID "@mozilla.org/content/html-menu-builder;1"
|
||||||
|
|
||||||
NS_IMPL_NS_NEW_HTML_ELEMENT(Menu)
|
NS_IMPL_NS_NEW_HTML_ELEMENT(Menu)
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
@ -97,12 +99,8 @@ HTMLMenuElement::CreateBuilder(nsIMenuBuilder** _retval)
|
||||||
{
|
{
|
||||||
NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_DOM_SECURITY_ERR);
|
NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_DOM_SECURITY_ERR);
|
||||||
|
|
||||||
*_retval = nullptr;
|
nsCOMPtr<nsIMenuBuilder> builder = CreateBuilder();
|
||||||
|
builder.swap(*_retval);
|
||||||
if (mType == MENU_TYPE_CONTEXT) {
|
|
||||||
NS_ADDREF(*_retval = new nsXULContextMenuBuilder());
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,8 +111,9 @@ HTMLMenuElement::CreateBuilder()
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIMenuBuilder> ret = new nsXULContextMenuBuilder();
|
nsCOMPtr<nsIMenuBuilder> builder = do_CreateInstance(HTMLMENUBUILDER_CONTRACTID);
|
||||||
return ret.forget();
|
NS_WARN_IF(!builder);
|
||||||
|
return builder.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|
|
@ -0,0 +1,132 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
// This component is used to build the menus for the HTML contextmenu attribute.
|
||||||
|
|
||||||
|
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
|
|
||||||
|
const Cc = Components.classes;
|
||||||
|
const Ci = Components.interfaces;
|
||||||
|
|
||||||
|
// A global value that is used to identify each menu item. It is
|
||||||
|
// incremented with each one that is found.
|
||||||
|
var gGeneratedId = 1;
|
||||||
|
|
||||||
|
function HTMLMenuBuilder() {
|
||||||
|
this.currentNode = null;
|
||||||
|
this.root = null;
|
||||||
|
this.items = {};
|
||||||
|
this.nestedStack = [];
|
||||||
|
};
|
||||||
|
|
||||||
|
// Building is done in two steps:
|
||||||
|
// The first generates a hierarchical JS object that contains the menu structure.
|
||||||
|
// This object is returned by toJSONString.
|
||||||
|
//
|
||||||
|
// The second step can take this structure and generate a XUL menu hierarchy or
|
||||||
|
// other UI from this object. The default UI is done in PageMenu.jsm.
|
||||||
|
//
|
||||||
|
// When a multi-process browser is used, the first step is performed by the child
|
||||||
|
// process and the second step is performed by the parent process.
|
||||||
|
|
||||||
|
HTMLMenuBuilder.prototype =
|
||||||
|
{
|
||||||
|
classID: Components.ID("{51c65f5d-0de5-4edc-9058-60e50cef77f8}"),
|
||||||
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsIMenuBuilder]),
|
||||||
|
|
||||||
|
currentNode: null,
|
||||||
|
root: null,
|
||||||
|
items: {},
|
||||||
|
nestedStack: [],
|
||||||
|
|
||||||
|
toJSONString: function() {
|
||||||
|
return JSON.stringify(this.root);
|
||||||
|
},
|
||||||
|
|
||||||
|
openContainer: function(aLabel) {
|
||||||
|
if (!this.currentNode) {
|
||||||
|
this.root = {
|
||||||
|
type: "menu",
|
||||||
|
children: []
|
||||||
|
};
|
||||||
|
this.currentNode = this.root;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
let parent = this.currentNode;
|
||||||
|
this.currentNode = {
|
||||||
|
type: "menu",
|
||||||
|
label: aLabel,
|
||||||
|
children: []
|
||||||
|
};
|
||||||
|
parent.children.push(this.currentNode);
|
||||||
|
this.nestedStack.push(parent);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
addItemFor: function(aElement, aCanLoadIcon) {
|
||||||
|
if (!("children" in this.currentNode)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let item = {
|
||||||
|
type: "menuitem",
|
||||||
|
label: aElement.label
|
||||||
|
};
|
||||||
|
|
||||||
|
let elementType = aElement.type;
|
||||||
|
if (elementType == "checkbox" || elementType == "radio") {
|
||||||
|
item.checkbox = true;
|
||||||
|
|
||||||
|
if (aElement.checked) {
|
||||||
|
item.checked = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let icon = aElement.icon;
|
||||||
|
if (icon.length > 0 && aCanLoadIcon) {
|
||||||
|
item.icon = icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aElement.disabled) {
|
||||||
|
item.disabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
item.id = gGeneratedId++;
|
||||||
|
this.currentNode.children.push(item);
|
||||||
|
|
||||||
|
this.items[item.id] = aElement;
|
||||||
|
},
|
||||||
|
|
||||||
|
addSeparator: function() {
|
||||||
|
if (!("children" in this.currentNode)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.currentNode.children.push({ type: "separator"});
|
||||||
|
},
|
||||||
|
|
||||||
|
undoAddSeparator: function() {
|
||||||
|
if (!("children" in this.currentNode)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let children = this.currentNode.children;
|
||||||
|
if (children.length && children[children.length - 1].type == "separator") {
|
||||||
|
children.pop();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
closeContainer: function() {
|
||||||
|
this.currentNode = this.nestedStack.length ? this.nestedStack.pop() : this.root;
|
||||||
|
},
|
||||||
|
|
||||||
|
click: function(id) {
|
||||||
|
let item = this.items[id];
|
||||||
|
if (item) {
|
||||||
|
item.click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([HTMLMenuBuilder]);
|
|
@ -0,0 +1,3 @@
|
||||||
|
component {51c65f5d-0de5-4edc-9058-60e50cef77f8} htmlMenuBuilder.js
|
||||||
|
contract @mozilla.org/content/html-menu-builder;1 {51c65f5d-0de5-4edc-9058-60e50cef77f8}
|
||||||
|
|
|
@ -215,6 +215,11 @@ SOURCES += [
|
||||||
'PluginDocument.cpp',
|
'PluginDocument.cpp',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
EXTRA_COMPONENTS += [
|
||||||
|
'htmlMenuBuilder.js',
|
||||||
|
'htmlMenuBuilder.manifest'
|
||||||
|
]
|
||||||
|
|
||||||
FAIL_ON_WARNINGS = True
|
FAIL_ON_WARNINGS = True
|
||||||
|
|
||||||
MSVC_ENABLE_PGO = True
|
MSVC_ENABLE_PGO = True
|
||||||
|
|
|
@ -11,7 +11,7 @@ interface nsIDOMHTMLMenuItemElement;
|
||||||
* An interface used to construct native toolbar or context menus from <menu>
|
* An interface used to construct native toolbar or context menus from <menu>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
[scriptable, uuid(12724737-f7db-43b4-94ab-708a7b86e115)]
|
[scriptable, uuid(93F4A48F-D043-4F45-97FD-9771EA1AF976)]
|
||||||
interface nsIMenuBuilder : nsISupports
|
interface nsIMenuBuilder : nsISupports
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -49,4 +49,28 @@ interface nsIMenuBuilder : nsISupports
|
||||||
*/
|
*/
|
||||||
void closeContainer();
|
void closeContainer();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a JSON string representing the menu hierarchy. For a context menu,
|
||||||
|
* it will be of the form:
|
||||||
|
* {
|
||||||
|
* type: "menu",
|
||||||
|
* children: [
|
||||||
|
* {
|
||||||
|
* type: "menuitem",
|
||||||
|
* label: "label",
|
||||||
|
* icon: "image.png"
|
||||||
|
* },
|
||||||
|
* {
|
||||||
|
* type: "separator",
|
||||||
|
* },
|
||||||
|
* ];
|
||||||
|
*/
|
||||||
|
AString toJSONString();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invoke the action of the menuitem with assigned id aGeneratedItemId.
|
||||||
|
*
|
||||||
|
* @param aGeneratedItemId the menuitem id
|
||||||
|
*/
|
||||||
|
void click(in DOMString aGeneratedItemId);
|
||||||
};
|
};
|
||||||
|
|
|
@ -94,6 +94,18 @@ ASSERT_ICC_CONTACT_TYPE_EQUALITY(Sdn, CARD_CONTACT_TYPE_SDN);
|
||||||
|
|
||||||
#undef ASSERT_ICC_CONTACT_TYPE_EQUALITY
|
#undef ASSERT_ICC_CONTACT_TYPE_EQUALITY
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enum IccMvnoType
|
||||||
|
*/
|
||||||
|
#define ASSERT_ICC_MVNO_TYPE_EQUALITY(webidlState, xpidlState) \
|
||||||
|
ASSERT_EQUALITY(IccMvnoType, webidlState, xpidlState)
|
||||||
|
|
||||||
|
ASSERT_ICC_MVNO_TYPE_EQUALITY(Imsi, CARD_MVNO_TYPE_IMSI);
|
||||||
|
ASSERT_ICC_MVNO_TYPE_EQUALITY(Spn, CARD_MVNO_TYPE_SPN);
|
||||||
|
ASSERT_ICC_MVNO_TYPE_EQUALITY(Gid, CARD_MVNO_TYPE_GID);
|
||||||
|
|
||||||
|
#undef ASSERT_ICC_MVNO_TYPE_EQUALITY
|
||||||
|
|
||||||
#undef ASSERT_EQUALITY
|
#undef ASSERT_EQUALITY
|
||||||
|
|
||||||
} // namespace icc
|
} // namespace icc
|
||||||
|
|
|
@ -384,8 +384,7 @@ Icc::UpdateContact(const JSContext* aCx, IccContactType aContactType,
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<DOMRequest>
|
already_AddRefed<DOMRequest>
|
||||||
Icc::MatchMvno(const nsAString& aMvnoType,
|
Icc::MatchMvno(IccMvnoType aMvnoType, const nsAString& aMvnoData,
|
||||||
const nsAString& aMvnoData,
|
|
||||||
ErrorResult& aRv)
|
ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
if (!mProvider) {
|
if (!mProvider) {
|
||||||
|
@ -395,8 +394,8 @@ Icc::MatchMvno(const nsAString& aMvnoType,
|
||||||
|
|
||||||
nsRefPtr<nsIDOMDOMRequest> request;
|
nsRefPtr<nsIDOMDOMRequest> request;
|
||||||
nsresult rv = mProvider->MatchMvno(mClientId, GetOwner(),
|
nsresult rv = mProvider->MatchMvno(mClientId, GetOwner(),
|
||||||
aMvnoType, aMvnoData,
|
static_cast<uint32_t>(aMvnoType),
|
||||||
getter_AddRefs(request));
|
aMvnoData, getter_AddRefs(request));
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
aRv.Throw(rv);
|
aRv.Throw(rv);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -98,7 +98,7 @@ public:
|
||||||
ErrorResult& aRv);
|
ErrorResult& aRv);
|
||||||
|
|
||||||
already_AddRefed<DOMRequest>
|
already_AddRefed<DOMRequest>
|
||||||
MatchMvno(const nsAString& aMvnoType, const nsAString& aMatchData,
|
MatchMvno(IccMvnoType aMvnoType, const nsAString& aMatchData,
|
||||||
ErrorResult& aRv);
|
ErrorResult& aRv);
|
||||||
|
|
||||||
IMPL_EVENT_HANDLER(iccinfochange)
|
IMPL_EVENT_HANDLER(iccinfochange)
|
||||||
|
|
|
@ -20,7 +20,7 @@ interface nsIIccListener : nsISupports
|
||||||
/**
|
/**
|
||||||
* XPCOM component (in the content process) that provides the ICC information.
|
* XPCOM component (in the content process) that provides the ICC information.
|
||||||
*/
|
*/
|
||||||
[scriptable, uuid(937213c3-f64e-4f58-b4e0-3010f219d0c3)]
|
[scriptable, uuid(c3e3c1a9-6ac4-4916-a777-7d49ffd89c46)]
|
||||||
interface nsIIccProvider : nsISupports
|
interface nsIIccProvider : nsISupports
|
||||||
{
|
{
|
||||||
// MUST match enum IccCardState in MozIcc.webidl!
|
// MUST match enum IccCardState in MozIcc.webidl!
|
||||||
|
@ -85,6 +85,11 @@ interface nsIIccProvider : nsISupports
|
||||||
const unsigned long CARD_CONTACT_TYPE_FDN = 1;
|
const unsigned long CARD_CONTACT_TYPE_FDN = 1;
|
||||||
const unsigned long CARD_CONTACT_TYPE_SDN = 2;
|
const unsigned long CARD_CONTACT_TYPE_SDN = 2;
|
||||||
|
|
||||||
|
// MUST match with enum IccMvnoType in MozIcc.webidl
|
||||||
|
const unsigned long CARD_MVNO_TYPE_IMSI = 0;
|
||||||
|
const unsigned long CARD_MVNO_TYPE_SPN = 1;
|
||||||
|
const unsigned long CARD_MVNO_TYPE_GID = 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a content process registers receiving unsolicited messages from
|
* Called when a content process registers receiving unsolicited messages from
|
||||||
* RadioInterfaceLayer in the chrome process. Only a content process that has
|
* RadioInterfaceLayer in the chrome process. Only a content process that has
|
||||||
|
@ -182,6 +187,6 @@ interface nsIIccProvider : nsISupports
|
||||||
*/
|
*/
|
||||||
nsIDOMDOMRequest matchMvno(in unsigned long clientId,
|
nsIDOMDOMRequest matchMvno(in unsigned long clientId,
|
||||||
in nsIDOMWindow window,
|
in nsIDOMWindow window,
|
||||||
in DOMString mvnoType,
|
in unsigned long mvnoType,
|
||||||
in DOMString mvnoData);
|
in DOMString mvnoData);
|
||||||
};
|
};
|
||||||
|
|
|
@ -70,6 +70,7 @@ GStreamerReader::GStreamerReader(AbstractMediaDecoder* aDecoder)
|
||||||
mMP3FrameParser(aDecoder->GetResource()->GetLength()),
|
mMP3FrameParser(aDecoder->GetResource()->GetLength()),
|
||||||
mDataOffset(0),
|
mDataOffset(0),
|
||||||
mUseParserDuration(false),
|
mUseParserDuration(false),
|
||||||
|
mLastParserDuration(-1),
|
||||||
#if GST_VERSION_MAJOR >= 1
|
#if GST_VERSION_MAJOR >= 1
|
||||||
mAllocator(nullptr),
|
mAllocator(nullptr),
|
||||||
mBufferPool(nullptr),
|
mBufferPool(nullptr),
|
||||||
|
|
|
@ -1250,7 +1250,9 @@ MediaCodecReader::DestroyMediaSources()
|
||||||
{
|
{
|
||||||
mAudioTrack.mSource = nullptr;
|
mAudioTrack.mSource = nullptr;
|
||||||
mVideoTrack.mSource = nullptr;
|
mVideoTrack.mSource = nullptr;
|
||||||
|
#if ANDROID_VERSION >= 21
|
||||||
mAudioOffloadTrack.mSource = nullptr;
|
mAudioOffloadTrack.mSource = nullptr;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1327,7 +1329,15 @@ MediaCodecReader::CreateMediaCodec(sp<ALooper>& aLooper,
|
||||||
if (aTrack.mType == Track::kVideo &&
|
if (aTrack.mType == Track::kVideo &&
|
||||||
aTrack.mCodec->getCapability(&capability) == OK &&
|
aTrack.mCodec->getCapability(&capability) == OK &&
|
||||||
(capability & MediaCodecProxy::kCanExposeGraphicBuffer) == MediaCodecProxy::kCanExposeGraphicBuffer) {
|
(capability & MediaCodecProxy::kCanExposeGraphicBuffer) == MediaCodecProxy::kCanExposeGraphicBuffer) {
|
||||||
|
#if ANDROID_VERSION >= 21
|
||||||
|
android::sp<android::IGraphicBufferProducer> producer;
|
||||||
|
android::sp<android::IGonkGraphicBufferConsumer> consumer;
|
||||||
|
GonkBufferQueue::createBufferQueue(&producer, &consumer);
|
||||||
|
aTrack.mNativeWindow = new GonkNativeWindow(consumer);
|
||||||
|
aTrack.mGraphicBufferProducer = producer;
|
||||||
|
#else
|
||||||
aTrack.mNativeWindow = new GonkNativeWindow();
|
aTrack.mNativeWindow = new GonkNativeWindow();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!aAsync) {
|
if (!aAsync) {
|
||||||
|
@ -1354,7 +1364,11 @@ MediaCodecReader::ConfigureMediaCodec(Track& aTrack)
|
||||||
|
|
||||||
sp<Surface> surface;
|
sp<Surface> surface;
|
||||||
if (aTrack.mNativeWindow != nullptr) {
|
if (aTrack.mNativeWindow != nullptr) {
|
||||||
|
#if ANDROID_VERSION >= 21
|
||||||
|
surface = new Surface(aTrack.mGraphicBufferProducer);
|
||||||
|
#else
|
||||||
surface = new Surface(aTrack.mNativeWindow->getBufferQueue());
|
surface = new Surface(aTrack.mNativeWindow->getBufferQueue());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
sp<MetaData> sourceFormat = aTrack.mSource->getFormat();
|
sp<MetaData> sourceFormat = aTrack.mSource->getFormat();
|
||||||
|
@ -1399,6 +1413,9 @@ MediaCodecReader::DestroyMediaCodec(Track& aTrack)
|
||||||
{
|
{
|
||||||
aTrack.mCodec = nullptr;
|
aTrack.mCodec = nullptr;
|
||||||
aTrack.mNativeWindow = nullptr;
|
aTrack.mNativeWindow = nullptr;
|
||||||
|
#if ANDROID_VERSION >= 21
|
||||||
|
aTrack.mGraphicBufferProducer = nullptr;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
@ -139,6 +139,9 @@ protected:
|
||||||
android::Vector<android::sp<android::ABuffer> > mInputBuffers;
|
android::Vector<android::sp<android::ABuffer> > mInputBuffers;
|
||||||
android::Vector<android::sp<android::ABuffer> > mOutputBuffers;
|
android::Vector<android::sp<android::ABuffer> > mOutputBuffers;
|
||||||
android::sp<android::GonkNativeWindow> mNativeWindow;
|
android::sp<android::GonkNativeWindow> mNativeWindow;
|
||||||
|
#if ANDROID_VERSION >= 21
|
||||||
|
android::sp<android::IGraphicBufferProducer> mGraphicBufferProducer;
|
||||||
|
#endif
|
||||||
|
|
||||||
// pipeline copier
|
// pipeline copier
|
||||||
nsAutoPtr<TrackInputCopier> mInputCopier;
|
nsAutoPtr<TrackInputCopier> mInputCopier;
|
||||||
|
|
|
@ -112,7 +112,7 @@ private:
|
||||||
mOffset += length;
|
mOffset += length;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mOffset < mFullLength) {
|
if (static_cast<uint64_t>(mOffset) < mFullLength) {
|
||||||
// We cannot read data in the main thread because it
|
// We cannot read data in the main thread because it
|
||||||
// might block for too long. Instead we post an IO task
|
// might block for too long. Instead we post an IO task
|
||||||
// to the IO thread if there is more data available.
|
// to the IO thread if there is more data available.
|
||||||
|
|
|
@ -254,8 +254,18 @@ bool OmxDecoder::AllocateMediaResources()
|
||||||
NS_ASSERTION(err == OK, "Failed to connect to OMX in mediaserver.");
|
NS_ASSERTION(err == OK, "Failed to connect to OMX in mediaserver.");
|
||||||
sp<IOMX> omx = client.interface();
|
sp<IOMX> omx = client.interface();
|
||||||
|
|
||||||
|
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 21
|
||||||
|
sp<IGraphicBufferProducer> producer;
|
||||||
|
sp<IGonkGraphicBufferConsumer> consumer;
|
||||||
|
GonkBufferQueue::createBufferQueue(&producer, &consumer);
|
||||||
|
mNativeWindow = new GonkNativeWindow(consumer);
|
||||||
|
#else
|
||||||
mNativeWindow = new GonkNativeWindow();
|
mNativeWindow = new GonkNativeWindow();
|
||||||
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
|
#endif
|
||||||
|
|
||||||
|
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 21
|
||||||
|
mNativeWindowClient = new GonkNativeWindowClient(producer);
|
||||||
|
#elif defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
|
||||||
mNativeWindowClient = new GonkNativeWindowClient(mNativeWindow->getBufferQueue());
|
mNativeWindowClient = new GonkNativeWindowClient(mNativeWindow->getBufferQueue());
|
||||||
#else
|
#else
|
||||||
mNativeWindowClient = new GonkNativeWindowClient(mNativeWindow);
|
mNativeWindowClient = new GonkNativeWindowClient(mNativeWindow);
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "AudioBufferSourceNode.h"
|
#include "AudioBufferSourceNode.h"
|
||||||
#include "mozilla/dom/AudioBufferSourceNodeBinding.h"
|
#include "mozilla/dom/AudioBufferSourceNodeBinding.h"
|
||||||
#include "mozilla/dom/AudioParam.h"
|
#include "mozilla/dom/AudioParam.h"
|
||||||
|
#include "mozilla/FloatingPoint.h"
|
||||||
#include "nsMathUtils.h"
|
#include "nsMathUtils.h"
|
||||||
#include "AudioNodeEngine.h"
|
#include "AudioNodeEngine.h"
|
||||||
#include "AudioNodeStream.h"
|
#include "AudioNodeStream.h"
|
||||||
|
@ -110,7 +111,7 @@ public:
|
||||||
mBeginProcessing = mStart + 0.5;
|
mBeginProcessing = mStart + 0.5;
|
||||||
break;
|
break;
|
||||||
case AudioBufferSourceNode::DOPPLERSHIFT:
|
case AudioBufferSourceNode::DOPPLERSHIFT:
|
||||||
mDopplerShift = aParam > 0 && aParam == aParam ? aParam : 1.0;
|
mDopplerShift = (aParam <= 0 || mozilla::IsNaN(aParam)) ? 1.0 : aParam;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
NS_ERROR("Bad AudioBufferSourceNodeEngine double parameter.");
|
NS_ERROR("Bad AudioBufferSourceNodeEngine double parameter.");
|
||||||
|
@ -415,7 +416,7 @@ public:
|
||||||
} else {
|
} else {
|
||||||
playbackRate = mPlaybackRateTimeline.GetValueAtTime(mSource->GetCurrentPosition());
|
playbackRate = mPlaybackRateTimeline.GetValueAtTime(mSource->GetCurrentPosition());
|
||||||
}
|
}
|
||||||
if (playbackRate <= 0 || playbackRate != playbackRate) {
|
if (playbackRate <= 0 || mozilla::IsNaN(playbackRate)) {
|
||||||
playbackRate = 1.0f;
|
playbackRate = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -181,7 +181,7 @@ namespace WebAudioUtils {
|
||||||
static_assert(mozilla::IsFloatingPoint<FloatType>::value == true,
|
static_assert(mozilla::IsFloatingPoint<FloatType>::value == true,
|
||||||
"FloatType must be a floating point type");
|
"FloatType must be a floating point type");
|
||||||
|
|
||||||
if (f != f) {
|
if (mozilla::IsNaN(f)) {
|
||||||
// It is the responsibility of the caller to deal with NaN values.
|
// It is the responsibility of the caller to deal with NaN values.
|
||||||
// If we ever get to this point, we have a serious bug to fix.
|
// If we ever get to this point, we have a serious bug to fix.
|
||||||
NS_RUNTIMEABORT("We should never see a NaN here");
|
NS_RUNTIMEABORT("We should never see a NaN here");
|
||||||
|
|
|
@ -691,40 +691,72 @@ MediaEngineGonkVideoSource::RotateImage(layers::Image* aImage, uint32_t aWidth,
|
||||||
gfx::BackendType::NONE,
|
gfx::BackendType::NONE,
|
||||||
layers::TextureFlags::DEFAULT,
|
layers::TextureFlags::DEFAULT,
|
||||||
layers::ALLOC_DISALLOW_BUFFERTEXTURECLIENT);
|
layers::ALLOC_DISALLOW_BUFFERTEXTURECLIENT);
|
||||||
if (!textureClient) {
|
if (textureClient) {
|
||||||
return;
|
RefPtr<layers::GrallocTextureClientOGL> grallocTextureClient =
|
||||||
|
static_cast<layers::GrallocTextureClientOGL*>(textureClient.get());
|
||||||
|
|
||||||
|
android::sp<android::GraphicBuffer> destBuffer = grallocTextureClient->GetGraphicBuffer();
|
||||||
|
|
||||||
|
void* destMem = nullptr;
|
||||||
|
destBuffer->lock(android::GraphicBuffer::USAGE_SW_WRITE_OFTEN, &destMem);
|
||||||
|
uint8_t* dstPtr = static_cast<uint8_t*>(destMem);
|
||||||
|
|
||||||
|
int32_t yStride = destBuffer->getStride();
|
||||||
|
// Align to 16 bytes boundary
|
||||||
|
int32_t uvStride = ((yStride / 2) + 15) & ~0x0F;
|
||||||
|
|
||||||
|
libyuv::ConvertToI420(srcPtr, size,
|
||||||
|
dstPtr, yStride,
|
||||||
|
dstPtr + (yStride * dstHeight + (uvStride * dstHeight / 2)), uvStride,
|
||||||
|
dstPtr + (yStride * dstHeight), uvStride,
|
||||||
|
0, 0,
|
||||||
|
aWidth, aHeight,
|
||||||
|
aWidth, aHeight,
|
||||||
|
static_cast<libyuv::RotationMode>(mRotation),
|
||||||
|
libyuv::FOURCC_NV21);
|
||||||
|
destBuffer->unlock();
|
||||||
|
|
||||||
|
layers::GrallocImage::GrallocData data;
|
||||||
|
|
||||||
|
data.mPicSize = gfx::IntSize(dstWidth, dstHeight);
|
||||||
|
data.mGraphicBuffer = textureClient;
|
||||||
|
videoImage->SetData(data);
|
||||||
|
} else {
|
||||||
|
// Handle out of gralloc case.
|
||||||
|
image = mImageContainer->CreateImage(ImageFormat::PLANAR_YCBCR);
|
||||||
|
layers::PlanarYCbCrImage* videoImage = static_cast<layers::PlanarYCbCrImage*>(image.get());
|
||||||
|
uint8_t* dstPtr = videoImage->AllocateAndGetNewBuffer(size);
|
||||||
|
|
||||||
|
libyuv::ConvertToI420(srcPtr, size,
|
||||||
|
dstPtr, dstWidth,
|
||||||
|
dstPtr + (dstWidth * dstHeight), half_width,
|
||||||
|
dstPtr + (dstWidth * dstHeight * 5 / 4), half_width,
|
||||||
|
0, 0,
|
||||||
|
aWidth, aHeight,
|
||||||
|
aWidth, aHeight,
|
||||||
|
static_cast<libyuv::RotationMode>(mRotation),
|
||||||
|
ConvertPixelFormatToFOURCC(graphicBuffer->getPixelFormat()));
|
||||||
|
|
||||||
|
const uint8_t lumaBpp = 8;
|
||||||
|
const uint8_t chromaBpp = 4;
|
||||||
|
|
||||||
|
layers::PlanarYCbCrData data;
|
||||||
|
data.mYChannel = dstPtr;
|
||||||
|
data.mYSize = IntSize(dstWidth, dstHeight);
|
||||||
|
data.mYStride = dstWidth * lumaBpp / 8;
|
||||||
|
data.mCbCrStride = dstWidth * chromaBpp / 8;
|
||||||
|
data.mCbChannel = dstPtr + dstHeight * data.mYStride;
|
||||||
|
data.mCrChannel = data.mCbChannel + data.mCbCrStride * (dstHeight / 2);
|
||||||
|
data.mCbCrSize = IntSize(dstWidth / 2, dstHeight / 2);
|
||||||
|
data.mPicX = 0;
|
||||||
|
data.mPicY = 0;
|
||||||
|
data.mPicSize = IntSize(dstWidth, dstHeight);
|
||||||
|
data.mStereoMode = StereoMode::MONO;
|
||||||
|
|
||||||
|
videoImage->SetDataNoCopy(data);
|
||||||
}
|
}
|
||||||
RefPtr<layers::GrallocTextureClientOGL> grallocTextureClient =
|
|
||||||
static_cast<layers::GrallocTextureClientOGL*>(textureClient.get());
|
|
||||||
|
|
||||||
android::sp<android::GraphicBuffer> destBuffer = grallocTextureClient->GetGraphicBuffer();
|
|
||||||
|
|
||||||
void* destMem = nullptr;
|
|
||||||
destBuffer->lock(android::GraphicBuffer::USAGE_SW_WRITE_OFTEN, &destMem);
|
|
||||||
uint8_t* dstPtr = static_cast<uint8_t*>(destMem);
|
|
||||||
|
|
||||||
int32_t yStride = destBuffer->getStride();
|
|
||||||
// Align to 16 bytes boundary
|
|
||||||
int32_t uvStride = ((yStride / 2) + 15) & ~0x0F;
|
|
||||||
|
|
||||||
libyuv::ConvertToI420(srcPtr, size,
|
|
||||||
dstPtr, yStride,
|
|
||||||
dstPtr + (yStride * dstHeight + (uvStride * dstHeight / 2)), uvStride,
|
|
||||||
dstPtr + (yStride * dstHeight), uvStride,
|
|
||||||
0, 0,
|
|
||||||
aWidth, aHeight,
|
|
||||||
aWidth, aHeight,
|
|
||||||
static_cast<libyuv::RotationMode>(mRotation),
|
|
||||||
libyuv::FOURCC_NV21);
|
|
||||||
destBuffer->unlock();
|
|
||||||
graphicBuffer->unlock();
|
graphicBuffer->unlock();
|
||||||
|
|
||||||
layers::GrallocImage::GrallocData data;
|
|
||||||
|
|
||||||
data.mPicSize = gfx::IntSize(dstWidth, dstHeight);
|
|
||||||
data.mGraphicBuffer = textureClient;
|
|
||||||
videoImage->SetData(data);
|
|
||||||
|
|
||||||
// Implicitly releases last preview image.
|
// Implicitly releases last preview image.
|
||||||
mImage = image.forget();
|
mImage = image.forget();
|
||||||
}
|
}
|
||||||
|
@ -767,9 +799,14 @@ MediaEngineGonkVideoSource::OnNewMediaBufferFrame(MediaBuffer* aBuffer)
|
||||||
|
|
||||||
MonitorAutoLock enter(mMonitor);
|
MonitorAutoLock enter(mMonitor);
|
||||||
if (mImage) {
|
if (mImage) {
|
||||||
GonkCameraImage* cameraImage = static_cast<GonkCameraImage*>(mImage.get());
|
if (mImage->AsGrallocImage()) {
|
||||||
|
// MediaEngineGonkVideoSource expects that GrallocImage is GonkCameraImage.
|
||||||
cameraImage->SetBuffer(aBuffer);
|
// See Bug 938034.
|
||||||
|
GonkCameraImage* cameraImage = static_cast<GonkCameraImage*>(mImage.get());
|
||||||
|
cameraImage->SetBuffer(aBuffer);
|
||||||
|
} else {
|
||||||
|
LOG(("mImage is non-GrallocImage"));
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t len = mSources.Length();
|
uint32_t len = mSources.Length();
|
||||||
for (uint32_t i = 0; i < len; i++) {
|
for (uint32_t i = 0; i < len; i++) {
|
||||||
|
@ -780,12 +817,15 @@ MediaEngineGonkVideoSource::OnNewMediaBufferFrame(MediaBuffer* aBuffer)
|
||||||
// Unfortunately, clock in gonk camera looks like is a different one
|
// Unfortunately, clock in gonk camera looks like is a different one
|
||||||
// comparing to MSG. As result, it causes time inaccurate. (frames be
|
// comparing to MSG. As result, it causes time inaccurate. (frames be
|
||||||
// queued in MSG longer and longer as time going by in device like Frame)
|
// queued in MSG longer and longer as time going by in device like Frame)
|
||||||
AppendToTrack(mSources[i], cameraImage, mTrackID, 1);
|
AppendToTrack(mSources[i], mImage, mTrackID, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Clear MediaBuffer immediately, it prevents MediaBuffer is kept in
|
if (mImage->AsGrallocImage()) {
|
||||||
// MediaStreamGraph thread.
|
GonkCameraImage* cameraImage = static_cast<GonkCameraImage*>(mImage.get());
|
||||||
cameraImage->ClearBuffer();
|
// Clear MediaBuffer immediately, it prevents MediaBuffer is kept in
|
||||||
|
// MediaStreamGraph thread.
|
||||||
|
cameraImage->ClearBuffer();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
#include "mozilla/dom/MozEmergencyCbModeEvent.h"
|
#include "mozilla/dom/MozEmergencyCbModeEvent.h"
|
||||||
#include "mozilla/dom/MozOtaStatusEvent.h"
|
#include "mozilla/dom/MozOtaStatusEvent.h"
|
||||||
#include "mozilla/dom/ToJSValue.h"
|
#include "mozilla/dom/ToJSValue.h"
|
||||||
#include "mozilla/dom/USSDReceivedEvent.h"
|
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
#include "mozilla/Services.h"
|
#include "mozilla/Services.h"
|
||||||
#include "nsIDOMDOMRequest.h"
|
#include "nsIDOMDOMRequest.h"
|
||||||
|
@ -592,48 +591,6 @@ MobileConnection::GetVoicePrivacyMode(ErrorResult& aRv)
|
||||||
return request.forget();
|
return request.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<DOMRequest>
|
|
||||||
MobileConnection::SendMMI(const nsAString& aMMIString, ErrorResult& aRv)
|
|
||||||
{
|
|
||||||
if (!mMobileConnection) {
|
|
||||||
aRv.Throw(NS_ERROR_FAILURE);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsRefPtr<DOMRequest> request = new DOMRequest(GetOwner());
|
|
||||||
nsRefPtr<MobileConnectionCallback> requestCallback =
|
|
||||||
new MobileConnectionCallback(GetOwner(), request);
|
|
||||||
|
|
||||||
nsresult rv = mMobileConnection->SendMMI(aMMIString, requestCallback);
|
|
||||||
if (NS_FAILED(rv)) {
|
|
||||||
aRv.Throw(rv);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return request.forget();
|
|
||||||
}
|
|
||||||
|
|
||||||
already_AddRefed<DOMRequest>
|
|
||||||
MobileConnection::CancelMMI(ErrorResult& aRv)
|
|
||||||
{
|
|
||||||
if (!mMobileConnection) {
|
|
||||||
aRv.Throw(NS_ERROR_FAILURE);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsRefPtr<DOMRequest> request = new DOMRequest(GetOwner());
|
|
||||||
nsRefPtr<MobileConnectionCallback> requestCallback =
|
|
||||||
new MobileConnectionCallback(GetOwner(), request);
|
|
||||||
|
|
||||||
nsresult rv = mMobileConnection->CancelMMI(requestCallback);
|
|
||||||
if (NS_FAILED(rv)) {
|
|
||||||
aRv.Throw(rv);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return request.forget();
|
|
||||||
}
|
|
||||||
|
|
||||||
already_AddRefed<DOMRequest>
|
already_AddRefed<DOMRequest>
|
||||||
MobileConnection::GetCallForwardingOption(uint16_t aReason, ErrorResult& aRv)
|
MobileConnection::GetCallForwardingOption(uint16_t aReason, ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
|
@ -990,26 +947,6 @@ MobileConnection::NotifyDataChanged()
|
||||||
return DispatchTrustedEvent(NS_LITERAL_STRING("datachange"));
|
return DispatchTrustedEvent(NS_LITERAL_STRING("datachange"));
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
MobileConnection::NotifyUssdReceived(const nsAString& aMessage,
|
|
||||||
bool aSessionEnded)
|
|
||||||
{
|
|
||||||
if (!CheckPermission("mobileconnection")) {
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
USSDReceivedEventInit init;
|
|
||||||
init.mBubbles = false;
|
|
||||||
init.mCancelable = false;
|
|
||||||
init.mMessage = aMessage;
|
|
||||||
init.mSessionEnded = aSessionEnded;
|
|
||||||
|
|
||||||
nsRefPtr<USSDReceivedEvent> event =
|
|
||||||
USSDReceivedEvent::Constructor(this, NS_LITERAL_STRING("ussdreceived"), init);
|
|
||||||
|
|
||||||
return DispatchTrustedEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
MobileConnection::NotifyDataError(const nsAString& aMessage)
|
MobileConnection::NotifyDataError(const nsAString& aMessage)
|
||||||
{
|
{
|
||||||
|
|
|
@ -107,12 +107,6 @@ public:
|
||||||
already_AddRefed<DOMRequest>
|
already_AddRefed<DOMRequest>
|
||||||
GetVoicePrivacyMode(ErrorResult& aRv);
|
GetVoicePrivacyMode(ErrorResult& aRv);
|
||||||
|
|
||||||
already_AddRefed<DOMRequest>
|
|
||||||
SendMMI(const nsAString& aMmi, ErrorResult& aRv);
|
|
||||||
|
|
||||||
already_AddRefed<DOMRequest>
|
|
||||||
CancelMMI(ErrorResult& aRv);
|
|
||||||
|
|
||||||
already_AddRefed<DOMRequest>
|
already_AddRefed<DOMRequest>
|
||||||
SetCallForwardingOption(const MozCallForwardingOptions& aOptions,
|
SetCallForwardingOption(const MozCallForwardingOptions& aOptions,
|
||||||
ErrorResult& aRv);
|
ErrorResult& aRv);
|
||||||
|
@ -150,7 +144,6 @@ public:
|
||||||
|
|
||||||
IMPL_EVENT_HANDLER(voicechange)
|
IMPL_EVENT_HANDLER(voicechange)
|
||||||
IMPL_EVENT_HANDLER(datachange)
|
IMPL_EVENT_HANDLER(datachange)
|
||||||
IMPL_EVENT_HANDLER(ussdreceived)
|
|
||||||
IMPL_EVENT_HANDLER(dataerror)
|
IMPL_EVENT_HANDLER(dataerror)
|
||||||
IMPL_EVENT_HANDLER(cfstatechange)
|
IMPL_EVENT_HANDLER(cfstatechange)
|
||||||
IMPL_EVENT_HANDLER(emergencycbmodechange)
|
IMPL_EVENT_HANDLER(emergencycbmodechange)
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
#include "MobileConnectionCallback.h"
|
#include "MobileConnectionCallback.h"
|
||||||
|
|
||||||
#include "mozilla/dom/DOMMMIError.h"
|
|
||||||
#include "mozilla/dom/MobileNetworkInfo.h"
|
#include "mozilla/dom/MobileNetworkInfo.h"
|
||||||
#include "mozilla/dom/MozMobileConnectionBinding.h"
|
#include "mozilla/dom/MozMobileConnectionBinding.h"
|
||||||
#include "mozilla/dom/ToJSValue.h"
|
#include "mozilla/dom/ToJSValue.h"
|
||||||
|
@ -31,28 +30,6 @@ MobileConnectionCallback::MobileConnectionCallback(nsPIDOMWindow* aWindow,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Notify Success for Send/CancelMmi.
|
|
||||||
*/
|
|
||||||
nsresult
|
|
||||||
MobileConnectionCallback::NotifySendCancelMmiSuccess(const MozMMIResult& aResult)
|
|
||||||
{
|
|
||||||
AutoJSAPI jsapi;
|
|
||||||
if (NS_WARN_IF(!jsapi.Init(mWindow))) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
JSContext* cx = jsapi.cx();
|
|
||||||
JS::Rooted<JS::Value> jsResult(cx);
|
|
||||||
|
|
||||||
if (!ToJSValue(cx, aResult, &jsResult)) {
|
|
||||||
JS_ClearPendingException(cx);
|
|
||||||
return NS_ERROR_TYPE_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NotifySuccess(jsResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify Success.
|
* Notify Success.
|
||||||
*/
|
*/
|
||||||
|
@ -130,131 +107,6 @@ MobileConnectionCallback::NotifyGetNetworksSuccess(uint32_t aCount,
|
||||||
return NotifySuccess(jsResult);
|
return NotifySuccess(jsResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
|
||||||
MobileConnectionCallback::NotifySendCancelMmiSuccess(const nsAString& aServiceCode,
|
|
||||||
const nsAString& aStatusMessage)
|
|
||||||
{
|
|
||||||
MozMMIResult result;
|
|
||||||
result.mServiceCode.Assign(aServiceCode);
|
|
||||||
result.mStatusMessage.Assign(aStatusMessage);
|
|
||||||
|
|
||||||
return NotifySendCancelMmiSuccess(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
MobileConnectionCallback::NotifySendCancelMmiSuccessWithInteger(const nsAString& aServiceCode,
|
|
||||||
const nsAString& aStatusMessage,
|
|
||||||
uint16_t aAdditionalInformation)
|
|
||||||
{
|
|
||||||
MozMMIResult result;
|
|
||||||
result.mServiceCode.Assign(aServiceCode);
|
|
||||||
result.mStatusMessage.Assign(aStatusMessage);
|
|
||||||
result.mAdditionalInformation.Construct().SetAsUnsignedShort() = aAdditionalInformation;
|
|
||||||
|
|
||||||
return NotifySendCancelMmiSuccess(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
MobileConnectionCallback::NotifySendCancelMmiSuccessWithStrings(const nsAString& aServiceCode,
|
|
||||||
const nsAString& aStatusMessage,
|
|
||||||
uint32_t aCount,
|
|
||||||
const char16_t** aAdditionalInformation)
|
|
||||||
{
|
|
||||||
AutoJSAPI jsapi;
|
|
||||||
if (NS_WARN_IF(!jsapi.Init(mWindow))) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
JSContext* cx = jsapi.cx();
|
|
||||||
RootedDictionary<MozMMIResult> result(cx);
|
|
||||||
|
|
||||||
result.mServiceCode.Assign(aServiceCode);
|
|
||||||
result.mStatusMessage.Assign(aStatusMessage);
|
|
||||||
|
|
||||||
nsTArray<nsString> additionalInformation;
|
|
||||||
for (uint32_t i = 0; i < aCount; i++) {
|
|
||||||
additionalInformation.AppendElement(nsDependentString(aAdditionalInformation[i]));
|
|
||||||
}
|
|
||||||
|
|
||||||
JS::Rooted<JS::Value> jsAdditionalInformation(cx);
|
|
||||||
if (!ToJSValue(cx, additionalInformation, &jsAdditionalInformation)) {
|
|
||||||
JS_ClearPendingException(cx);
|
|
||||||
return NS_ERROR_TYPE_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
result.mAdditionalInformation.Construct().SetAsObject() =
|
|
||||||
&jsAdditionalInformation.toObject();
|
|
||||||
|
|
||||||
return NotifySendCancelMmiSuccess(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
MobileConnectionCallback::NotifySendCancelMmiSuccessWithCallForwardingOptions(
|
|
||||||
const nsAString& aServiceCode,
|
|
||||||
const nsAString& aStatusMessage,
|
|
||||||
uint32_t aCount,
|
|
||||||
nsIMobileCallForwardingOptions** aResults)
|
|
||||||
{
|
|
||||||
AutoJSAPI jsapi;
|
|
||||||
if (NS_WARN_IF(!jsapi.Init(mWindow))) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
JSContext* cx = jsapi.cx();
|
|
||||||
RootedDictionary<MozMMIResult> result(cx);
|
|
||||||
|
|
||||||
result.mServiceCode.Assign(aServiceCode);
|
|
||||||
result.mStatusMessage.Assign(aStatusMessage);
|
|
||||||
|
|
||||||
nsTArray<MozCallForwardingOptions> additionalInformation;
|
|
||||||
for (uint32_t i = 0; i < aCount; i++)
|
|
||||||
{
|
|
||||||
MozCallForwardingOptions options;
|
|
||||||
int16_t pShort;
|
|
||||||
nsString pString;
|
|
||||||
bool pBool;
|
|
||||||
|
|
||||||
aResults[i]->GetActive(&pBool);
|
|
||||||
options.mActive.Construct(pBool);
|
|
||||||
|
|
||||||
aResults[i]->GetAction(&pShort);
|
|
||||||
if (pShort != nsIMobileConnection::CALL_FORWARD_ACTION_UNKNOWN) {
|
|
||||||
options.mAction.Construct(pShort);
|
|
||||||
}
|
|
||||||
|
|
||||||
aResults[i]->GetReason(&pShort);
|
|
||||||
if (pShort != nsIMobileConnection::CALL_FORWARD_REASON_UNKNOWN) {
|
|
||||||
options.mReason.Construct(pShort);
|
|
||||||
}
|
|
||||||
|
|
||||||
aResults[i]->GetNumber(pString);
|
|
||||||
options.mNumber.Construct(pString.get());
|
|
||||||
|
|
||||||
aResults[i]->GetTimeSeconds(&pShort);
|
|
||||||
if (pShort >= 0) {
|
|
||||||
options.mTimeSeconds.Construct(pShort);
|
|
||||||
}
|
|
||||||
|
|
||||||
aResults[i]->GetServiceClass(&pShort);
|
|
||||||
if (pShort != nsIMobileConnection::ICC_SERVICE_CLASS_NONE) {
|
|
||||||
options.mServiceClass.Construct(pShort);
|
|
||||||
}
|
|
||||||
|
|
||||||
additionalInformation.AppendElement(options);
|
|
||||||
}
|
|
||||||
|
|
||||||
JS::Rooted<JS::Value> jsAdditionalInformation(cx);
|
|
||||||
if (!ToJSValue(cx, additionalInformation, &jsAdditionalInformation)) {
|
|
||||||
JS_ClearPendingException(cx);
|
|
||||||
return NS_ERROR_TYPE_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
result.mAdditionalInformation.Construct().SetAsObject() =
|
|
||||||
&jsAdditionalInformation.toObject();
|
|
||||||
|
|
||||||
return NotifySendCancelMmiSuccess(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
MobileConnectionCallback::NotifyGetCallForwardingSuccess(uint32_t aCount,
|
MobileConnectionCallback::NotifyGetCallForwardingSuccess(uint32_t aCount,
|
||||||
nsIMobileCallForwardingOptions** aResults)
|
nsIMobileCallForwardingOptions** aResults)
|
||||||
|
@ -384,34 +236,11 @@ MobileConnectionCallback::NotifyGetRoamingPreferenceSuccess(int32_t aMode)
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
MobileConnectionCallback::NotifyError(const nsAString& aName,
|
MobileConnectionCallback::NotifyError(const nsAString& aName)
|
||||||
const nsAString& aMessage,
|
|
||||||
const nsAString& aServiceCode,
|
|
||||||
uint16_t aInfo,
|
|
||||||
uint8_t aArgc)
|
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIDOMRequestService> rs = do_GetService(DOMREQUEST_SERVICE_CONTRACTID);
|
nsCOMPtr<nsIDOMRequestService> rs = do_GetService(DOMREQUEST_SERVICE_CONTRACTID);
|
||||||
NS_ENSURE_TRUE(rs, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(rs, NS_ERROR_FAILURE);
|
||||||
|
return rs->FireErrorAsync(mRequest, aName);
|
||||||
nsRefPtr<DOMError> error;
|
|
||||||
switch (aArgc) {
|
|
||||||
case 0:
|
|
||||||
return rs->FireErrorAsync(mRequest, aName);
|
|
||||||
case 1:
|
|
||||||
error = new DOMMMIError(mWindow, aName, aMessage, EmptyString(),
|
|
||||||
Nullable<int16_t>());
|
|
||||||
return rs->FireDetailedError(mRequest, error);
|
|
||||||
case 2:
|
|
||||||
error = new DOMMMIError(mWindow, aName, aMessage, aServiceCode,
|
|
||||||
Nullable<int16_t>());
|
|
||||||
return rs->FireDetailedError(mRequest, error);
|
|
||||||
case 3:
|
|
||||||
error = new DOMMMIError(mWindow, aName, aMessage, aServiceCode,
|
|
||||||
Nullable<int16_t>(int16_t(aInfo)));
|
|
||||||
return rs->FireDetailedError(mRequest, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace mobileconnection
|
} // namespace mobileconnection
|
||||||
|
|
|
@ -41,9 +41,6 @@ private:
|
||||||
nsresult
|
nsresult
|
||||||
NotifySuccessWithString(const nsAString& aResult);
|
NotifySuccessWithString(const nsAString& aResult);
|
||||||
|
|
||||||
nsresult
|
|
||||||
NotifySendCancelMmiSuccess(const MozMMIResult& aResult);
|
|
||||||
|
|
||||||
nsCOMPtr<nsPIDOMWindow> mWindow;
|
nsCOMPtr<nsPIDOMWindow> mWindow;
|
||||||
nsRefPtr<DOMRequest> mRequest;
|
nsRefPtr<DOMRequest> mRequest;
|
||||||
};
|
};
|
||||||
|
|
|
@ -27,8 +27,6 @@ const MOBILECELLINFO_CID =
|
||||||
Components.ID("{0635d9ab-997e-4cdf-84e7-c1883752dff3}");
|
Components.ID("{0635d9ab-997e-4cdf-84e7-c1883752dff3}");
|
||||||
const MOBILECALLFORWARDINGOPTIONS_CID =
|
const MOBILECALLFORWARDINGOPTIONS_CID =
|
||||||
Components.ID("{e0cf4463-ee63-4b05-ab2e-d94bf764836c}");
|
Components.ID("{e0cf4463-ee63-4b05-ab2e-d94bf764836c}");
|
||||||
const TELEPHONYDIALCALLBACK_CID =
|
|
||||||
Components.ID("{c2af1a5d-3649-44ef-a1ff-18e9ac1dec51}");
|
|
||||||
const NEIGHBORINGCELLINFO_CID =
|
const NEIGHBORINGCELLINFO_CID =
|
||||||
Components.ID("{6078cbf1-f34c-44fa-96f8-11a88d4bfdd3}");
|
Components.ID("{6078cbf1-f34c-44fa-96f8-11a88d4bfdd3}");
|
||||||
const GSMCELLINFO_CID =
|
const GSMCELLINFO_CID =
|
||||||
|
@ -280,62 +278,6 @@ CdmaCellInfo.prototype = {
|
||||||
evdoSnr: INT32_MAX
|
evdoSnr: INT32_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Wrap a MobileConnectionCallback to a TelephonyDialCallback.
|
|
||||||
*/
|
|
||||||
function TelephonyDialCallback(aCallback) {
|
|
||||||
this.callback = aCallback;
|
|
||||||
}
|
|
||||||
TelephonyDialCallback.prototype = {
|
|
||||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsITelephonyDialCallback]),
|
|
||||||
classID: TELEPHONYDIALCALLBACK_CID,
|
|
||||||
|
|
||||||
notifyDialMMI: function(mmiServiceCode) {
|
|
||||||
this.serviceCode = mmiServiceCode;
|
|
||||||
},
|
|
||||||
|
|
||||||
notifyDialMMISuccess: function(statusMessage) {
|
|
||||||
this.callback.notifySendCancelMmiSuccess(this.serviceCode, statusMessage);
|
|
||||||
},
|
|
||||||
|
|
||||||
notifyDialMMISuccessWithInteger: function(statusMessage, additionalInfo) {
|
|
||||||
this.callback.notifySendCancelMmiSuccessWithInteger(this.serviceCode,
|
|
||||||
statusMessage,
|
|
||||||
additionalInfo);
|
|
||||||
},
|
|
||||||
|
|
||||||
notifyDialMMISuccessWithStrings: function(statusMessage, count, additionalInfo) {
|
|
||||||
this.callback.notifySendCancelMmiSuccessWithStrings(this.serviceCode,
|
|
||||||
statusMessage,
|
|
||||||
count,
|
|
||||||
additionalInfo);
|
|
||||||
},
|
|
||||||
|
|
||||||
notifyDialMMISuccessWithCallForwardingOptions: function(statusMessage, count, additionalInfo) {
|
|
||||||
this.callback.notifySendCancelMmiSuccessWithCallForwardingOptions(
|
|
||||||
this.serviceCode,
|
|
||||||
statusMessage,
|
|
||||||
count,
|
|
||||||
additionalInfo);
|
|
||||||
},
|
|
||||||
|
|
||||||
notifyDialMMIError: function(error) {
|
|
||||||
this.callback.notifyError(error, "", this.serviceCode);
|
|
||||||
},
|
|
||||||
|
|
||||||
notifyDialMMIErrorWithInfo: function(error, info) {
|
|
||||||
this.callback.notifyError(error, "", this.serviceCode, info);
|
|
||||||
},
|
|
||||||
|
|
||||||
notifyDialError: function() {
|
|
||||||
throw Cr.NS_ERROR_UNEXPECTED;
|
|
||||||
},
|
|
||||||
|
|
||||||
notifyDialSuccess: function() {
|
|
||||||
throw Cr.NS_ERROR_UNEXPECTED;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
function MobileConnectionProvider(aClientId, aRadioInterface) {
|
function MobileConnectionProvider(aClientId, aRadioInterface) {
|
||||||
this._clientId = aClientId;
|
this._clientId = aClientId;
|
||||||
this._radioInterface = aRadioInterface;
|
this._radioInterface = aRadioInterface;
|
||||||
|
@ -833,24 +775,6 @@ MobileConnectionProvider.prototype = {
|
||||||
}).bind(this));
|
}).bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
sendMMI: function(aMmi, aCallback) {
|
|
||||||
let callback = new TelephonyDialCallback(aCallback);
|
|
||||||
gGonkTelephonyService.dialMMI(this._clientId, aMmi, callback);
|
|
||||||
},
|
|
||||||
|
|
||||||
cancelMMI: function(aCallback) {
|
|
||||||
this._radioInterface.sendWorkerMessage("cancelUSSD", null,
|
|
||||||
(function(aResponse) {
|
|
||||||
if (aResponse.errorMsg) {
|
|
||||||
aCallback.notifyError(aResponse.errorMsg);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
aCallback.notifySuccess();
|
|
||||||
return false;
|
|
||||||
}).bind(this));
|
|
||||||
},
|
|
||||||
|
|
||||||
setCallForwarding: function(aAction, aReason, aNumber, aTimeSeconds,
|
setCallForwarding: function(aAction, aReason, aNumber, aTimeSeconds,
|
||||||
aServiceClass, aCallback) {
|
aServiceClass, aCallback) {
|
||||||
let options = {
|
let options = {
|
||||||
|
@ -1190,18 +1114,6 @@ MobileConnectionService.prototype = {
|
||||||
this.getItemByServiceId(aClientId).updateDataInfo(aDataInfo);
|
this.getItemByServiceId(aClientId).updateDataInfo(aDataInfo);
|
||||||
},
|
},
|
||||||
|
|
||||||
notifyUssdReceived: function(aClientId, aMessage, aSessionEnded) {
|
|
||||||
if (DEBUG) {
|
|
||||||
debug("notifyUssdReceived for " + aClientId + ": " +
|
|
||||||
aMessage + " (sessionEnded : " + aSessionEnded + ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
gMobileConnectionMessenger.notifyUssdReceived(aClientId, aMessage, aSessionEnded);
|
|
||||||
|
|
||||||
this.getItemByServiceId(aClientId)
|
|
||||||
.deliverListenerEvent("notifyUssdReceived", [aMessage, aSessionEnded]);
|
|
||||||
},
|
|
||||||
|
|
||||||
notifyDataError: function(aClientId, aMessage) {
|
notifyDataError: function(aClientId, aMessage) {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
debug("notifyDataError for " + aClientId + ": " + aMessage);
|
debug("notifyDataError for " + aClientId + ": " + aMessage);
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
"@mozilla.org/mobileconnection/gonkmobileconnectionservice;1"
|
"@mozilla.org/mobileconnection/gonkmobileconnectionservice;1"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
[scriptable, uuid(eae40ffe-394a-4355-8e0b-07170d3e70f4)]
|
[scriptable, uuid(ef49b866-85a0-11e4-b023-f73e02752840)]
|
||||||
interface nsIGonkMobileConnectionService : nsIMobileConnectionService
|
interface nsIGonkMobileConnectionService : nsIMobileConnectionService
|
||||||
{
|
{
|
||||||
void notifyNetworkInfoChanged(in unsigned long clientId, in jsval networkInfo);
|
void notifyNetworkInfoChanged(in unsigned long clientId, in jsval networkInfo);
|
||||||
|
@ -29,10 +29,6 @@ interface nsIGonkMobileConnectionService : nsIMobileConnectionService
|
||||||
void notifyRadioStateChanged(in unsigned long clientId,
|
void notifyRadioStateChanged(in unsigned long clientId,
|
||||||
in long radioState);
|
in long radioState);
|
||||||
|
|
||||||
void notifyUssdReceived(in unsigned long clientId,
|
|
||||||
in DOMString message,
|
|
||||||
in boolean sessionEnded);
|
|
||||||
|
|
||||||
void notifyEmergencyCallbackModeChanged(in unsigned long clientId,
|
void notifyEmergencyCallbackModeChanged(in unsigned long clientId,
|
||||||
in boolean active,
|
in boolean active,
|
||||||
in unsigned long timeoutMs);
|
in unsigned long timeoutMs);
|
||||||
|
|
|
@ -4,23 +4,9 @@
|
||||||
|
|
||||||
#include "nsISupports.idl"
|
#include "nsISupports.idl"
|
||||||
|
|
||||||
[scriptable, uuid(fd2fa95c-5b54-11e4-bc6b-6f3bffb681cd)]
|
[scriptable, uuid(b9ec941e-8504-11e4-810e-7b62c60e8261)]
|
||||||
interface nsIMobileConnectionMessenger : nsISupports
|
interface nsIMobileConnectionMessenger : nsISupports
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* 'ussd-received' system message
|
|
||||||
*
|
|
||||||
* @param aServiceId
|
|
||||||
* The ID of Service where this info is notified from.
|
|
||||||
* @param aMessage
|
|
||||||
* USSD Message to be displayed.
|
|
||||||
* @param aSessionEnded
|
|
||||||
* True if USSD session is ended.
|
|
||||||
*/
|
|
||||||
void notifyUssdReceived(in unsigned long aServiceId,
|
|
||||||
in DOMString aMessage,
|
|
||||||
in boolean aSessionEnded);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 'cdma-info-rec-received' system message with Display Info
|
* 'cdma-info-rec-received' system message with Display Info
|
||||||
*
|
*
|
||||||
|
|
|
@ -12,7 +12,7 @@ interface nsIMobileNetworkInfo;
|
||||||
interface nsINeighboringCellIdsCallback;
|
interface nsINeighboringCellIdsCallback;
|
||||||
interface nsIVariant;
|
interface nsIVariant;
|
||||||
|
|
||||||
[scriptable, uuid(c00abd30-5b2e-11e4-8ed6-0800200c9a66)]
|
[scriptable, uuid(6e6468a4-84fb-11e4-9b66-17dbe13c059e)]
|
||||||
interface nsIMobileConnectionListener : nsISupports
|
interface nsIMobileConnectionListener : nsISupports
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -25,17 +25,6 @@ interface nsIMobileConnectionListener : nsISupports
|
||||||
*/
|
*/
|
||||||
void notifyDataChanged();
|
void notifyDataChanged();
|
||||||
|
|
||||||
/**
|
|
||||||
* Notify when ussd is received.
|
|
||||||
*
|
|
||||||
* @param message
|
|
||||||
* The ussd request in string format.
|
|
||||||
* @param sessionEnded
|
|
||||||
* Indicates whether the session is ended.
|
|
||||||
*/
|
|
||||||
void notifyUssdReceived(in DOMString message,
|
|
||||||
in boolean sessionEnded);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify when data call is failed to establish.
|
* Notify when data call is failed to establish.
|
||||||
*
|
*
|
||||||
|
@ -124,7 +113,7 @@ interface nsIMobileConnectionListener : nsISupports
|
||||||
#define NO_ADDITIONAL_INFORMATION 0
|
#define NO_ADDITIONAL_INFORMATION 0
|
||||||
%}
|
%}
|
||||||
|
|
||||||
[scriptable, builtinclass, uuid(16e77f19-0298-46de-ae49-9b2fb92a28c0)]
|
[scriptable, builtinclass, uuid(14d66926-8434-11e4-8c3f-f724194bb5f1)]
|
||||||
interface nsIMobileConnectionCallback : nsISupports
|
interface nsIMobileConnectionCallback : nsISupports
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -137,27 +126,9 @@ interface nsIMobileConnectionCallback : nsISupports
|
||||||
void notifyGetNetworksSuccess(in uint32_t count,
|
void notifyGetNetworksSuccess(in uint32_t count,
|
||||||
[array, size_is(count)] in nsIMobileNetworkInfo networks);
|
[array, size_is(count)] in nsIMobileNetworkInfo networks);
|
||||||
|
|
||||||
void notifySendCancelMmiSuccess(in DOMString aServiceCode,
|
|
||||||
in DOMString aStatusMessage);
|
|
||||||
|
|
||||||
void notifySendCancelMmiSuccessWithInteger(in DOMString aServiceCode,
|
|
||||||
in DOMString aStatusMessage,
|
|
||||||
in unsigned short aAdditionalInformation);
|
|
||||||
|
|
||||||
void notifySendCancelMmiSuccessWithStrings(in DOMString aServiceCode,
|
|
||||||
in DOMString aStatusMessage,
|
|
||||||
in unsigned long aLength,
|
|
||||||
[array, size_is(aLength)] in wstring aAdditionalInformation);
|
|
||||||
|
|
||||||
void notifySendCancelMmiSuccessWithCallForwardingOptions(in DOMString aServiceCode,
|
|
||||||
in DOMString aStatusMessage,
|
|
||||||
in unsigned long aLength,
|
|
||||||
[array, size_is(aLength)] in nsIMobileCallForwardingOptions aAdditionalInformation);
|
|
||||||
|
|
||||||
void notifyGetCallForwardingSuccess(in uint32_t count,
|
void notifyGetCallForwardingSuccess(in uint32_t count,
|
||||||
[array, size_is(count)] in nsIMobileCallForwardingOptions results);
|
[array, size_is(count)] in nsIMobileCallForwardingOptions results);
|
||||||
|
|
||||||
|
|
||||||
void notifyGetCallBarringSuccess(in unsigned short program,
|
void notifyGetCallBarringSuccess(in unsigned short program,
|
||||||
in boolean enabled,
|
in boolean enabled,
|
||||||
in unsigned short serviceClass);
|
in unsigned short serviceClass);
|
||||||
|
@ -171,45 +142,7 @@ interface nsIMobileConnectionCallback : nsISupports
|
||||||
/**
|
/**
|
||||||
* notifyError() will be called, when request is failed.
|
* notifyError() will be called, when request is failed.
|
||||||
*/
|
*/
|
||||||
[optional_argc]
|
void notifyError(in DOMString name);
|
||||||
void notifyError(in DOMString name,
|
|
||||||
[optional] in DOMString message,
|
|
||||||
[optional] in DOMString serviceCode,
|
|
||||||
[optional] in unsigned short additionalInformation);
|
|
||||||
|
|
||||||
%{C++
|
|
||||||
// non-virtual so it won't affect the vtable
|
|
||||||
inline nsresult NotifyError(const nsAString& aName)
|
|
||||||
{
|
|
||||||
return NotifyError(aName, EmptyString(), EmptyString(),
|
|
||||||
NO_ADDITIONAL_INFORMATION, 0 /* ARGC = 0 */);
|
|
||||||
}
|
|
||||||
// non-virtual so it won't affect the vtable
|
|
||||||
inline nsresult NotifyError(const nsAString& aName,
|
|
||||||
const nsAString& aMessage)
|
|
||||||
{
|
|
||||||
return NotifyError(aName, aMessage, EmptyString(), NO_ADDITIONAL_INFORMATION,
|
|
||||||
1 /* ARGC = 1 */);
|
|
||||||
}
|
|
||||||
// non-virtual so it won't affect the vtable
|
|
||||||
inline nsresult NotifyError(const nsAString& aName,
|
|
||||||
const nsAString& aMessage,
|
|
||||||
const nsAString& aServiceCode)
|
|
||||||
{
|
|
||||||
return NotifyError(aName, aMessage, aServiceCode, NO_ADDITIONAL_INFORMATION,
|
|
||||||
2 /* ARGC = 2 */);
|
|
||||||
}
|
|
||||||
// non-virtual so it won't affect the vtable
|
|
||||||
inline nsresult NotifyError(const nsAString& aName,
|
|
||||||
const nsAString& aMessage,
|
|
||||||
const nsAString& aServiceCode,
|
|
||||||
uint16_t aAdditionInformation)
|
|
||||||
{
|
|
||||||
return NotifyError(aName, aMessage, aServiceCode, aAdditionInformation,
|
|
||||||
3 /* ARGC = 3 */);
|
|
||||||
}
|
|
||||||
%}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
%{C++
|
%{C++
|
||||||
|
@ -235,7 +168,7 @@ already_AddRefed<nsIMobileConnectionService>
|
||||||
NS_CreateMobileConnectionService();
|
NS_CreateMobileConnectionService();
|
||||||
%}
|
%}
|
||||||
|
|
||||||
[scriptable, uuid(99e43353-5fc4-497e-88a2-5fa6862ee64c)]
|
[scriptable, uuid(2b3d0122-8054-11e4-964e-c727f38fd7e6)]
|
||||||
interface nsIMobileConnection : nsISupports
|
interface nsIMobileConnection : nsISupports
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -549,36 +482,6 @@ interface nsIMobileConnection : nsISupports
|
||||||
*/
|
*/
|
||||||
void getVoicePrivacyMode(in nsIMobileConnectionCallback requestCallback);
|
void getVoicePrivacyMode(in nsIMobileConnectionCallback requestCallback);
|
||||||
|
|
||||||
/**
|
|
||||||
* Send a MMI message.
|
|
||||||
*
|
|
||||||
* @param mmi
|
|
||||||
* DOMString containing an MMI string that can be associated to a
|
|
||||||
* USSD request or other RIL functionality.
|
|
||||||
* @param requestCallback
|
|
||||||
* Called when request is finished.
|
|
||||||
*
|
|
||||||
* If successful, the notifySendCancelMmiSuccess*() will be called. And the
|
|
||||||
* result will contain the information about the mmi operation.
|
|
||||||
*
|
|
||||||
* Otherwise, the notifyError() will be called.
|
|
||||||
*/
|
|
||||||
void sendMMI(in DOMString mmi,
|
|
||||||
in nsIMobileConnectionCallback requestCallback);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cancel the current MMI request if one exists.
|
|
||||||
*
|
|
||||||
* @param requestCallback
|
|
||||||
* Called when request is finished.
|
|
||||||
*
|
|
||||||
* If successful, the notifySendCancelMmiSuccess*() will be called. And the
|
|
||||||
* result will contain the information about the mmi operation.
|
|
||||||
*
|
|
||||||
* Otherwise, the notifyError() will be called.
|
|
||||||
*/
|
|
||||||
void cancelMMI(in nsIMobileConnectionCallback requestCallback);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Queries current call forwarding options.
|
* Queries current call forwarding options.
|
||||||
*
|
*
|
||||||
|
|
|
@ -222,20 +222,6 @@ MobileConnectionChild::GetVoicePrivacyMode(nsIMobileConnectionCallback* aCallbac
|
||||||
? NS_OK : NS_ERROR_FAILURE;
|
? NS_OK : NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
MobileConnectionChild::SendMMI(const nsAString& aMmi,
|
|
||||||
nsIMobileConnectionCallback* aCallback)
|
|
||||||
{
|
|
||||||
return SendRequest(SendMmiRequest(nsAutoString(aMmi)), aCallback)
|
|
||||||
? NS_OK : NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
MobileConnectionChild::CancelMMI(nsIMobileConnectionCallback* aCallback)
|
|
||||||
{
|
|
||||||
return SendRequest(CancelMmiRequest(), aCallback) ? NS_OK : NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
MobileConnectionChild::SetCallForwarding(uint16_t aAction, uint16_t aReason,
|
MobileConnectionChild::SetCallForwarding(uint16_t aAction, uint16_t aReason,
|
||||||
const nsAString& aNumber,
|
const nsAString& aNumber,
|
||||||
|
@ -415,17 +401,6 @@ MobileConnectionChild::RecvNotifyDataInfoChanged(nsIMobileConnectionInfo* const&
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
MobileConnectionChild::RecvNotifyUssdReceived(const nsString& aMessage,
|
|
||||||
const bool& aSessionEnd)
|
|
||||||
{
|
|
||||||
for (int32_t i = 0; i < mListeners.Count(); i++) {
|
|
||||||
mListeners[i]->NotifyUssdReceived(aMessage, aSessionEnd);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
MobileConnectionChild::RecvNotifyDataError(const nsString& aMessage)
|
MobileConnectionChild::RecvNotifyDataError(const nsString& aMessage)
|
||||||
{
|
{
|
||||||
|
@ -568,60 +543,6 @@ MobileConnectionRequestChild::DoReply(const MobileConnectionReplySuccessNetworks
|
||||||
const_cast<nsIMobileNetworkInfo**>(aReply.results().Elements())));
|
const_cast<nsIMobileNetworkInfo**>(aReply.results().Elements())));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
MobileConnectionRequestChild::DoReply(const MobileConnectionReplySuccessMmi& aReply)
|
|
||||||
{
|
|
||||||
nsAutoString serviceCode(aReply.serviceCode());
|
|
||||||
nsAutoString statusMessage(aReply.statusMessage());
|
|
||||||
AdditionalInformation info(aReply.additionalInformation());
|
|
||||||
|
|
||||||
// Handle union types
|
|
||||||
switch (info.type()) {
|
|
||||||
case AdditionalInformation::Tvoid_t:
|
|
||||||
return NS_SUCCEEDED(mRequestCallback->NotifySendCancelMmiSuccess(serviceCode,
|
|
||||||
statusMessage));
|
|
||||||
|
|
||||||
case AdditionalInformation::Tuint16_t:
|
|
||||||
return NS_SUCCEEDED(mRequestCallback->NotifySendCancelMmiSuccessWithInteger(
|
|
||||||
serviceCode, statusMessage, info.get_uint16_t()));
|
|
||||||
|
|
||||||
case AdditionalInformation::TArrayOfnsString: {
|
|
||||||
uint32_t count = info.get_ArrayOfnsString().Length();
|
|
||||||
const nsTArray<nsString>& additionalInformation = info.get_ArrayOfnsString();
|
|
||||||
|
|
||||||
nsAutoArrayPtr<const char16_t*> additionalInfoPtrs(new const char16_t*[count]);
|
|
||||||
for (size_t i = 0; i < count; ++i) {
|
|
||||||
additionalInfoPtrs[i] = additionalInformation[i].get();
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_SUCCEEDED(mRequestCallback->NotifySendCancelMmiSuccessWithStrings(
|
|
||||||
serviceCode, statusMessage, count, additionalInfoPtrs));
|
|
||||||
}
|
|
||||||
|
|
||||||
case AdditionalInformation::TArrayOfnsMobileCallForwardingOptions: {
|
|
||||||
uint32_t count = info.get_ArrayOfnsMobileCallForwardingOptions().Length();
|
|
||||||
|
|
||||||
nsTArray<nsCOMPtr<nsIMobileCallForwardingOptions>> results;
|
|
||||||
for (uint32_t i = 0; i < count; i++) {
|
|
||||||
// Use dont_AddRef here because these instances are already AddRef-ed in
|
|
||||||
// MobileConnectionIPCSerializer.h
|
|
||||||
nsCOMPtr<nsIMobileCallForwardingOptions> item = dont_AddRef(
|
|
||||||
info.get_ArrayOfnsMobileCallForwardingOptions()[i]);
|
|
||||||
results.AppendElement(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_SUCCEEDED(mRequestCallback->NotifySendCancelMmiSuccessWithCallForwardingOptions(
|
|
||||||
serviceCode, statusMessage, count,
|
|
||||||
const_cast<nsIMobileCallForwardingOptions**>(info.get_ArrayOfnsMobileCallForwardingOptions().Elements())));
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
MOZ_CRASH("Received invalid type!");
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
MobileConnectionRequestChild::DoReply(const MobileConnectionReplySuccessCallForwarding& aReply)
|
MobileConnectionRequestChild::DoReply(const MobileConnectionReplySuccessCallForwarding& aReply)
|
||||||
{
|
{
|
||||||
|
@ -671,32 +592,6 @@ MobileConnectionRequestChild::DoReply(const MobileConnectionReplyError& aReply)
|
||||||
return NS_SUCCEEDED(mRequestCallback->NotifyError(aReply.message()));
|
return NS_SUCCEEDED(mRequestCallback->NotifyError(aReply.message()));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
MobileConnectionRequestChild::DoReply(const MobileConnectionReplyErrorMmi& aReply)
|
|
||||||
{
|
|
||||||
nsAutoString name(aReply.name());
|
|
||||||
nsAutoString message(aReply.message());
|
|
||||||
nsAutoString serviceCode(aReply.serviceCode());
|
|
||||||
AdditionalInformation info(aReply.additionalInformation());
|
|
||||||
|
|
||||||
// Handle union types
|
|
||||||
switch (info.type()) {
|
|
||||||
case AdditionalInformation::Tuint16_t:
|
|
||||||
return NS_SUCCEEDED(mRequestCallback->NotifyError(name,
|
|
||||||
message,
|
|
||||||
serviceCode,
|
|
||||||
info.get_uint16_t()));
|
|
||||||
case AdditionalInformation::Tvoid_t:
|
|
||||||
default:
|
|
||||||
// If additionInfomation is not uint16_t, handle it as void_t.
|
|
||||||
return NS_SUCCEEDED(mRequestCallback->NotifyError(name,
|
|
||||||
message,
|
|
||||||
serviceCode));
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
MobileConnectionRequestChild::Recv__delete__(const MobileConnectionReply& aReply)
|
MobileConnectionRequestChild::Recv__delete__(const MobileConnectionReply& aReply)
|
||||||
{
|
{
|
||||||
|
@ -709,8 +604,6 @@ MobileConnectionRequestChild::Recv__delete__(const MobileConnectionReply& aReply
|
||||||
return DoReply(aReply.get_MobileConnectionReplySuccessBoolean());
|
return DoReply(aReply.get_MobileConnectionReplySuccessBoolean());
|
||||||
case MobileConnectionReply::TMobileConnectionReplySuccessNetworks:
|
case MobileConnectionReply::TMobileConnectionReplySuccessNetworks:
|
||||||
return DoReply(aReply.get_MobileConnectionReplySuccessNetworks());
|
return DoReply(aReply.get_MobileConnectionReplySuccessNetworks());
|
||||||
case MobileConnectionReply::TMobileConnectionReplySuccessMmi:
|
|
||||||
return DoReply(aReply.get_MobileConnectionReplySuccessMmi());
|
|
||||||
case MobileConnectionReply::TMobileConnectionReplySuccessCallForwarding:
|
case MobileConnectionReply::TMobileConnectionReplySuccessCallForwarding:
|
||||||
return DoReply(aReply.get_MobileConnectionReplySuccessCallForwarding());
|
return DoReply(aReply.get_MobileConnectionReplySuccessCallForwarding());
|
||||||
case MobileConnectionReply::TMobileConnectionReplySuccessCallBarring:
|
case MobileConnectionReply::TMobileConnectionReplySuccessCallBarring:
|
||||||
|
@ -723,8 +616,6 @@ MobileConnectionRequestChild::Recv__delete__(const MobileConnectionReply& aReply
|
||||||
return DoReply(aReply.get_MobileConnectionReplySuccessRoamingPreference());
|
return DoReply(aReply.get_MobileConnectionReplySuccessRoamingPreference());
|
||||||
case MobileConnectionReply::TMobileConnectionReplyError:
|
case MobileConnectionReply::TMobileConnectionReplyError:
|
||||||
return DoReply(aReply.get_MobileConnectionReplyError());
|
return DoReply(aReply.get_MobileConnectionReplyError());
|
||||||
case MobileConnectionReply::TMobileConnectionReplyErrorMmi:
|
|
||||||
return DoReply(aReply.get_MobileConnectionReplyErrorMmi());
|
|
||||||
default:
|
default:
|
||||||
MOZ_CRASH("Received invalid response type!");
|
MOZ_CRASH("Received invalid response type!");
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,10 +69,6 @@ protected:
|
||||||
virtual bool
|
virtual bool
|
||||||
RecvNotifyDataInfoChanged(nsIMobileConnectionInfo* const& aInfo) MOZ_OVERRIDE;
|
RecvNotifyDataInfoChanged(nsIMobileConnectionInfo* const& aInfo) MOZ_OVERRIDE;
|
||||||
|
|
||||||
virtual bool
|
|
||||||
RecvNotifyUssdReceived(const nsString& aMessage,
|
|
||||||
const bool& aSessionEnd) MOZ_OVERRIDE;
|
|
||||||
|
|
||||||
virtual bool
|
virtual bool
|
||||||
RecvNotifyDataError(const nsString& aMessage) MOZ_OVERRIDE;
|
RecvNotifyDataError(const nsString& aMessage) MOZ_OVERRIDE;
|
||||||
|
|
||||||
|
@ -148,9 +144,6 @@ public:
|
||||||
bool
|
bool
|
||||||
DoReply(const MobileConnectionReplySuccessNetworks& aReply);
|
DoReply(const MobileConnectionReplySuccessNetworks& aReply);
|
||||||
|
|
||||||
bool
|
|
||||||
DoReply(const MobileConnectionReplySuccessMmi& aReply);
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DoReply(const MobileConnectionReplySuccessCallForwarding& aReply);
|
DoReply(const MobileConnectionReplySuccessCallForwarding& aReply);
|
||||||
|
|
||||||
|
@ -169,9 +162,6 @@ public:
|
||||||
bool
|
bool
|
||||||
DoReply(const MobileConnectionReplyError& aReply);
|
DoReply(const MobileConnectionReplyError& aReply);
|
||||||
|
|
||||||
bool
|
|
||||||
DoReply(const MobileConnectionReplyErrorMmi& aReply);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual
|
virtual
|
||||||
~MobileConnectionRequestChild()
|
~MobileConnectionRequestChild()
|
||||||
|
|
|
@ -67,10 +67,6 @@ MobileConnectionParent::RecvPMobileConnectionRequestConstructor(PMobileConnectio
|
||||||
return actor->DoRequest(aRequest.get_SetVoicePrivacyModeRequest());
|
return actor->DoRequest(aRequest.get_SetVoicePrivacyModeRequest());
|
||||||
case MobileConnectionRequest::TGetVoicePrivacyModeRequest:
|
case MobileConnectionRequest::TGetVoicePrivacyModeRequest:
|
||||||
return actor->DoRequest(aRequest.get_GetVoicePrivacyModeRequest());
|
return actor->DoRequest(aRequest.get_GetVoicePrivacyModeRequest());
|
||||||
case MobileConnectionRequest::TSendMmiRequest:
|
|
||||||
return actor->DoRequest(aRequest.get_SendMmiRequest());
|
|
||||||
case MobileConnectionRequest::TCancelMmiRequest:
|
|
||||||
return actor->DoRequest(aRequest.get_CancelMmiRequest());
|
|
||||||
case MobileConnectionRequest::TSetCallForwardingRequest:
|
case MobileConnectionRequest::TSetCallForwardingRequest:
|
||||||
return actor->DoRequest(aRequest.get_SetCallForwardingRequest());
|
return actor->DoRequest(aRequest.get_SetCallForwardingRequest());
|
||||||
case MobileConnectionRequest::TGetCallForwardingRequest:
|
case MobileConnectionRequest::TGetCallForwardingRequest:
|
||||||
|
@ -192,16 +188,6 @@ MobileConnectionParent::NotifyDataChanged()
|
||||||
return SendNotifyDataInfoChanged(info.forget().take()) ? NS_OK : NS_ERROR_FAILURE;
|
return SendNotifyDataInfoChanged(info.forget().take()) ? NS_OK : NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
MobileConnectionParent::NotifyUssdReceived(const nsAString& aMessage,
|
|
||||||
bool aSessionEnded)
|
|
||||||
{
|
|
||||||
NS_ENSURE_TRUE(mLive, NS_ERROR_FAILURE);
|
|
||||||
|
|
||||||
return SendNotifyUssdReceived(nsAutoString(aMessage), aSessionEnded)
|
|
||||||
? NS_OK : NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
MobileConnectionParent::NotifyDataError(const nsAString& aMessage)
|
MobileConnectionParent::NotifyDataError(const nsAString& aMessage)
|
||||||
{
|
{
|
||||||
|
@ -399,22 +385,6 @@ MobileConnectionRequestParent::DoRequest(const GetVoicePrivacyModeRequest& aRequ
|
||||||
return NS_SUCCEEDED(mMobileConnection->GetVoicePrivacyMode(this));
|
return NS_SUCCEEDED(mMobileConnection->GetVoicePrivacyMode(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
MobileConnectionRequestParent::DoRequest(const SendMmiRequest& aRequest)
|
|
||||||
{
|
|
||||||
NS_ENSURE_TRUE(mMobileConnection, false);
|
|
||||||
|
|
||||||
return NS_SUCCEEDED(mMobileConnection->SendMMI(aRequest.mmi(), this));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
MobileConnectionRequestParent::DoRequest(const CancelMmiRequest& aRequest)
|
|
||||||
{
|
|
||||||
NS_ENSURE_TRUE(mMobileConnection, false);
|
|
||||||
|
|
||||||
return NS_SUCCEEDED(mMobileConnection->CancelMMI(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
MobileConnectionRequestParent::DoRequest(const SetCallForwardingRequest& aRequest)
|
MobileConnectionRequestParent::DoRequest(const SetCallForwardingRequest& aRequest)
|
||||||
{
|
{
|
||||||
|
@ -556,57 +526,6 @@ MobileConnectionRequestParent::NotifyGetNetworksSuccess(uint32_t aCount,
|
||||||
return SendReply(MobileConnectionReplySuccessNetworks(networks));
|
return SendReply(MobileConnectionReplySuccessNetworks(networks));
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
MobileConnectionRequestParent::NotifySendCancelMmiSuccess(const nsAString& aServiceCode,
|
|
||||||
const nsAString& aStatusMessage)
|
|
||||||
{
|
|
||||||
return SendReply(MobileConnectionReplySuccessMmi(nsString(aServiceCode),
|
|
||||||
nsString(aStatusMessage),
|
|
||||||
AdditionalInformation(mozilla::void_t())));
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
MobileConnectionRequestParent::NotifySendCancelMmiSuccessWithInteger(const nsAString& aServiceCode,
|
|
||||||
const nsAString& aStatusMessage,
|
|
||||||
uint16_t aAdditionalInformation)
|
|
||||||
{
|
|
||||||
return SendReply(MobileConnectionReplySuccessMmi(nsString(aServiceCode),
|
|
||||||
nsString(aStatusMessage),
|
|
||||||
AdditionalInformation(aAdditionalInformation)));
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
MobileConnectionRequestParent::NotifySendCancelMmiSuccessWithStrings(const nsAString& aServiceCode,
|
|
||||||
const nsAString& aStatusMessage,
|
|
||||||
uint32_t aCount,
|
|
||||||
const char16_t** aAdditionalInformation)
|
|
||||||
{
|
|
||||||
nsTArray<nsString> additionalInformation;
|
|
||||||
for (uint32_t i = 0; i < aCount; i++) {
|
|
||||||
additionalInformation.AppendElement(nsDependentString(aAdditionalInformation[i]));
|
|
||||||
}
|
|
||||||
|
|
||||||
return SendReply(MobileConnectionReplySuccessMmi(nsString(aServiceCode),
|
|
||||||
nsString(aStatusMessage),
|
|
||||||
AdditionalInformation(additionalInformation)));
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
MobileConnectionRequestParent::NotifySendCancelMmiSuccessWithCallForwardingOptions(const nsAString& aServiceCode,
|
|
||||||
const nsAString& aStatusMessage,
|
|
||||||
uint32_t aCount,
|
|
||||||
nsIMobileCallForwardingOptions** aAdditionalInformation)
|
|
||||||
{
|
|
||||||
nsTArray<nsIMobileCallForwardingOptions*> additionalInformation;
|
|
||||||
for (uint32_t i = 0; i < aCount; i++) {
|
|
||||||
additionalInformation.AppendElement(aAdditionalInformation[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return SendReply(MobileConnectionReplySuccessMmi(nsString(aServiceCode),
|
|
||||||
nsString(aStatusMessage),
|
|
||||||
AdditionalInformation(additionalInformation)));
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
MobileConnectionRequestParent::NotifyGetCallForwardingSuccess(uint32_t aCount,
|
MobileConnectionRequestParent::NotifyGetCallForwardingSuccess(uint32_t aCount,
|
||||||
nsIMobileCallForwardingOptions** aResults)
|
nsIMobileCallForwardingOptions** aResults)
|
||||||
|
@ -648,26 +567,8 @@ MobileConnectionRequestParent::NotifyGetRoamingPreferenceSuccess(int32_t aMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
MobileConnectionRequestParent::NotifyError(const nsAString& aName,
|
MobileConnectionRequestParent::NotifyError(const nsAString& aName)
|
||||||
const nsAString& aMessage,
|
|
||||||
const nsAString& aServiceCode,
|
|
||||||
uint16_t aInfo,
|
|
||||||
uint8_t aArgc)
|
|
||||||
{
|
{
|
||||||
if (aArgc == 0) {
|
nsAutoString error(aName);
|
||||||
nsAutoString error(aName);
|
return SendReply(MobileConnectionReplyError(error));
|
||||||
return SendReply(MobileConnectionReplyError(error));
|
|
||||||
}
|
|
||||||
|
|
||||||
nsAutoString name(aName);
|
|
||||||
nsAutoString message(aMessage);
|
|
||||||
nsAutoString serviceCode(aServiceCode);
|
|
||||||
|
|
||||||
if (aArgc < 3) {
|
|
||||||
return SendReply(MobileConnectionReplyErrorMmi(name, message, serviceCode,
|
|
||||||
AdditionalInformation(mozilla::void_t())));
|
|
||||||
}
|
|
||||||
|
|
||||||
return SendReply(MobileConnectionReplyErrorMmi(name, message, serviceCode,
|
|
||||||
AdditionalInformation(aInfo)));
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,12 +111,6 @@ public:
|
||||||
bool
|
bool
|
||||||
DoRequest(const GetVoicePrivacyModeRequest& aRequest);
|
DoRequest(const GetVoicePrivacyModeRequest& aRequest);
|
||||||
|
|
||||||
bool
|
|
||||||
DoRequest(const SendMmiRequest& aRequest);
|
|
||||||
|
|
||||||
bool
|
|
||||||
DoRequest(const CancelMmiRequest& aRequest);
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DoRequest(const SetCallForwardingRequest& aRequest);
|
DoRequest(const SetCallForwardingRequest& aRequest);
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ sync protocol PMobileConnection
|
||||||
child:
|
child:
|
||||||
NotifyVoiceInfoChanged(nsMobileConnectionInfo aInfo);
|
NotifyVoiceInfoChanged(nsMobileConnectionInfo aInfo);
|
||||||
NotifyDataInfoChanged(nsMobileConnectionInfo aInfo);
|
NotifyDataInfoChanged(nsMobileConnectionInfo aInfo);
|
||||||
NotifyUssdReceived(nsString aMessage, bool aSessionEnd);
|
|
||||||
NotifyDataError(nsString aMessage);
|
NotifyDataError(nsString aMessage);
|
||||||
NotifyCFStateChanged(uint16_t aAction, uint16_t aReason, nsString aNumber,
|
NotifyCFStateChanged(uint16_t aAction, uint16_t aReason, nsString aNumber,
|
||||||
uint16_t aTimeSeconds, uint16_t aServiceClass);
|
uint16_t aTimeSeconds, uint16_t aServiceClass);
|
||||||
|
@ -97,15 +96,6 @@ struct GetVoicePrivacyModeRequest
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SendMmiRequest
|
|
||||||
{
|
|
||||||
nsString mmi;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct CancelMmiRequest
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SetCallForwardingRequest
|
struct SetCallForwardingRequest
|
||||||
{
|
{
|
||||||
uint16_t action;
|
uint16_t action;
|
||||||
|
@ -179,8 +169,6 @@ union MobileConnectionRequest
|
||||||
GetRoamingPreferenceRequest;
|
GetRoamingPreferenceRequest;
|
||||||
SetVoicePrivacyModeRequest;
|
SetVoicePrivacyModeRequest;
|
||||||
GetVoicePrivacyModeRequest;
|
GetVoicePrivacyModeRequest;
|
||||||
SendMmiRequest;
|
|
||||||
CancelMmiRequest;
|
|
||||||
SetCallForwardingRequest;
|
SetCallForwardingRequest;
|
||||||
GetCallForwardingRequest;
|
GetCallForwardingRequest;
|
||||||
SetCallBarringRequest;
|
SetCallBarringRequest;
|
||||||
|
|
|
@ -40,13 +40,6 @@ struct MobileConnectionReplySuccessNetworks
|
||||||
nsMobileNetworkInfo[] results;
|
nsMobileNetworkInfo[] results;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MobileConnectionReplySuccessMmi
|
|
||||||
{
|
|
||||||
nsString serviceCode;
|
|
||||||
nsString statusMessage;
|
|
||||||
AdditionalInformation additionalInformation;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct MobileConnectionReplySuccessCallForwarding
|
struct MobileConnectionReplySuccessCallForwarding
|
||||||
{
|
{
|
||||||
nsMobileCallForwardingOptions[] results;
|
nsMobileCallForwardingOptions[] results;
|
||||||
|
@ -81,21 +74,12 @@ struct MobileConnectionReplyError
|
||||||
nsString message;
|
nsString message;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MobileConnectionReplyErrorMmi
|
|
||||||
{
|
|
||||||
nsString name;
|
|
||||||
nsString message;
|
|
||||||
nsString serviceCode;
|
|
||||||
AdditionalInformation additionalInformation;
|
|
||||||
};
|
|
||||||
|
|
||||||
union MobileConnectionReply
|
union MobileConnectionReply
|
||||||
{
|
{
|
||||||
// Success
|
// Success
|
||||||
MobileConnectionReplySuccess;
|
MobileConnectionReplySuccess;
|
||||||
MobileConnectionReplySuccessBoolean;
|
MobileConnectionReplySuccessBoolean;
|
||||||
MobileConnectionReplySuccessNetworks;
|
MobileConnectionReplySuccessNetworks;
|
||||||
MobileConnectionReplySuccessMmi;
|
|
||||||
MobileConnectionReplySuccessCallForwarding;
|
MobileConnectionReplySuccessCallForwarding;
|
||||||
MobileConnectionReplySuccessCallBarring;
|
MobileConnectionReplySuccessCallBarring;
|
||||||
MobileConnectionReplySuccessClirStatus;
|
MobileConnectionReplySuccessClirStatus;
|
||||||
|
@ -103,7 +87,6 @@ union MobileConnectionReply
|
||||||
MobileConnectionReplySuccessRoamingPreference;
|
MobileConnectionReplySuccessRoamingPreference;
|
||||||
// Error
|
// Error
|
||||||
MobileConnectionReplyError;
|
MobileConnectionReplyError;
|
||||||
MobileConnectionReplyErrorMmi;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mobileconnection
|
} // namespace mobileconnection
|
||||||
|
|
|
@ -14,10 +14,6 @@ qemu = true
|
||||||
[test_mobile_data_connection.js]
|
[test_mobile_data_connection.js]
|
||||||
[test_mobile_data_location.js]
|
[test_mobile_data_location.js]
|
||||||
[test_mobile_data_state.js]
|
[test_mobile_data_state.js]
|
||||||
[test_mobile_mmi.js]
|
|
||||||
[test_mobile_mmi_change_pin.js]
|
|
||||||
[test_mobile_mmi_call_forwarding.js]
|
|
||||||
[test_mobile_mmi_unlock_puk.js]
|
|
||||||
[test_mobile_roaming_preference.js]
|
[test_mobile_roaming_preference.js]
|
||||||
[test_call_barring_get_option.js]
|
[test_call_barring_get_option.js]
|
||||||
[test_call_barring_set_error.js]
|
[test_call_barring_set_error.js]
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
|
||||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
||||||
|
|
||||||
MARIONETTE_TIMEOUT = 60000;
|
|
||||||
MARIONETTE_HEAD_JS = "head.js";
|
|
||||||
|
|
||||||
function testGettingIMEI() {
|
|
||||||
log("Test *#06# ...");
|
|
||||||
|
|
||||||
let MMI_CODE = "*#06#";
|
|
||||||
return sendMMI(MMI_CODE)
|
|
||||||
.then(function resolve(aResult) {
|
|
||||||
ok(true, MMI_CODE + " success");
|
|
||||||
is(aResult.serviceCode, "scImei", "Service code IMEI");
|
|
||||||
// IMEI is hardcoded as "000000000000000".
|
|
||||||
// See it here {B2G_HOME}/external/qemu/telephony/android_modem.c
|
|
||||||
// (The result of +CGSN).
|
|
||||||
is(aResult.statusMessage, "000000000000000", "Emulator IMEI");
|
|
||||||
is(aResult.additionalInformation, undefined, "No additional information");
|
|
||||||
}, function reject() {
|
|
||||||
ok(false, MMI_CODE + " should not fail");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function testInvalidMMICode() {
|
|
||||||
log("Test invalid MMI code ...");
|
|
||||||
|
|
||||||
let MMI_CODE = "InvalidMMICode";
|
|
||||||
return sendMMI(MMI_CODE)
|
|
||||||
.then(function resolve() {
|
|
||||||
ok(false, MMI_CODE + " should not success");
|
|
||||||
}, function reject(aError) {
|
|
||||||
ok(true, MMI_CODE + " fail");
|
|
||||||
is(aError.name, "emMmiError", "MMI error name");
|
|
||||||
is(aError.message, "", "No message");
|
|
||||||
is(aError.serviceCode, "scUssd", "Service code USSD");
|
|
||||||
is(aError.additionalInformation, null, "No additional information");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start test
|
|
||||||
startTestCommon(function() {
|
|
||||||
return Promise.resolve()
|
|
||||||
.then(() => testGettingIMEI())
|
|
||||||
.then(() => testInvalidMMICode());
|
|
||||||
});
|
|
|
@ -1,144 +0,0 @@
|
||||||
/* 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 = [
|
|
||||||
{
|
|
||||||
reason: MozMobileConnection.CALL_FORWARD_REASON_UNCONDITIONAL,
|
|
||||||
number: "+886912345678",
|
|
||||||
serviceClass: MozMobileConnection.ICC_SERVICE_CLASS_VOICE,
|
|
||||||
timeSeconds: 5
|
|
||||||
}, {
|
|
||||||
reason: MozMobileConnection.CALL_FORWARD_REASON_MOBILE_BUSY,
|
|
||||||
number: "0912345678",
|
|
||||||
serviceClass: MozMobileConnection.ICC_SERVICE_CLASS_VOICE,
|
|
||||||
timeSeconds: 10
|
|
||||||
}, {
|
|
||||||
reason: MozMobileConnection.CALL_FORWARD_REASON_NO_REPLY,
|
|
||||||
number: "+886987654321",
|
|
||||||
serviceClass: MozMobileConnection.ICC_SERVICE_CLASS_VOICE,
|
|
||||||
timeSeconds: 15
|
|
||||||
}, {
|
|
||||||
reason: MozMobileConnection.CALL_FORWARD_REASON_NOT_REACHABLE,
|
|
||||||
number: "+0987654321",
|
|
||||||
serviceClass: MozMobileConnection.ICC_SERVICE_CLASS_VOICE,
|
|
||||||
timeSeconds: 20
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
// Please see TS 22.030 Annex B
|
|
||||||
const CF_REASON_TO_MMI = {
|
|
||||||
/* CALL_FORWARD_REASON_UNCONDITIONAL */
|
|
||||||
0: "21",
|
|
||||||
/* CALL_FORWARD_REASON_MOBILE_BUSY */
|
|
||||||
1: "67",
|
|
||||||
/* CALL_FORWARD_REASON_NO_REPLY */
|
|
||||||
2: "61",
|
|
||||||
/* CALL_FORWARD_REASON_NOT_REACHABLE */
|
|
||||||
3: "62",
|
|
||||||
/* CALL_FORWARD_REASON_ALL_CALL_FORWARDING */
|
|
||||||
4: "002",
|
|
||||||
/* CALL_FORWARD_REASON_ALL_CONDITIONAL_CALL_FORWARDING */
|
|
||||||
5: "004"
|
|
||||||
};
|
|
||||||
|
|
||||||
// Please see TS 22.030 Annex C
|
|
||||||
const SERVICE_CLASS_TO_MMI = {
|
|
||||||
/* ICC_SERVICE_CLASS_VOICE */
|
|
||||||
1: "11"
|
|
||||||
};
|
|
||||||
|
|
||||||
function testSetCallForwarding(aData) {
|
|
||||||
// Registration: **SC*SIA*SIB*SIC#
|
|
||||||
let MMI_CODE = "**" + CF_REASON_TO_MMI[aData.reason] + "*" + aData.number +
|
|
||||||
"*" + SERVICE_CLASS_TO_MMI[aData.serviceClass] +
|
|
||||||
"*" + aData.timeSeconds + "#";
|
|
||||||
log("Test " + MMI_CODE);
|
|
||||||
|
|
||||||
let promises = [];
|
|
||||||
// Check cfstatechange event.
|
|
||||||
promises.push(waitForManagerEvent("cfstatechange").then(function(aEvent) {
|
|
||||||
is(aEvent.action, MozMobileConnection.CALL_FORWARD_ACTION_REGISTRATION,
|
|
||||||
"check action");
|
|
||||||
is(aEvent.reason, aData.reason, "check reason");
|
|
||||||
is(aEvent.number, aData.number, "check number");
|
|
||||||
is(aEvent.timeSeconds, aData.timeSeconds, "check timeSeconds");
|
|
||||||
is(aEvent.serviceClass, aData.serviceClass, "check serviceClass");
|
|
||||||
}));
|
|
||||||
// Check DOMRequest's result.
|
|
||||||
promises.push(sendMMI(MMI_CODE)
|
|
||||||
.then(function resolve(aResult) {
|
|
||||||
is(aResult.serviceCode, "scCallForwarding", "Check service code");
|
|
||||||
is(aResult.statusMessage, "smServiceRegistered", "Check status message");
|
|
||||||
is(aResult.additionalInformation, undefined, "Check additional information");
|
|
||||||
}, function reject(aError) {
|
|
||||||
ok(false, "got '" + aError.name + "' error");
|
|
||||||
}));
|
|
||||||
|
|
||||||
return Promise.all(promises);
|
|
||||||
}
|
|
||||||
|
|
||||||
function testGetCallForwarding(aExpectedData) {
|
|
||||||
// Interrogation: *#SC#
|
|
||||||
let MMI_CODE = "*#" + CF_REASON_TO_MMI[aExpectedData.reason] + "#";
|
|
||||||
log("Test " + MMI_CODE);
|
|
||||||
|
|
||||||
return sendMMI(MMI_CODE)
|
|
||||||
.then(function resolve(aResult) {
|
|
||||||
is(aResult.serviceCode, "scCallForwarding", "Check service code");
|
|
||||||
is(aResult.statusMessage, "smServiceInterrogated", "Check status message");
|
|
||||||
is(Array.isArray(aResult.additionalInformation), true,
|
|
||||||
"additionalInformation should be an array");
|
|
||||||
|
|
||||||
for (let i = 0; i < aResult.additionalInformation.length; i++) {
|
|
||||||
let result = aResult.additionalInformation[i];
|
|
||||||
|
|
||||||
// Only need to check the result containing the serviceClass that we are
|
|
||||||
// interested in.
|
|
||||||
if (!(result.serviceClass & aExpectedData.serviceClass)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
is(result.active, true, "check active");
|
|
||||||
is(result.reason, aExpectedData.reason, "check reason");
|
|
||||||
is(result.number, aExpectedData.number, "check number");
|
|
||||||
is(result.timeSeconds, aExpectedData.timeSeconds, "check timeSeconds");
|
|
||||||
}
|
|
||||||
}, function reject(aError) {
|
|
||||||
ok(false, MMI_CODE + " got error: " + aError.name);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function clearAllCallForwardingSettings() {
|
|
||||||
log("Clear all call forwarding settings");
|
|
||||||
|
|
||||||
let promise = Promise.resolve();
|
|
||||||
for (let reason = MozMobileConnection.CALL_FORWARD_REASON_UNCONDITIONAL;
|
|
||||||
reason <= MozMobileConnection.CALL_FORWARD_REASON_ALL_CONDITIONAL_CALL_FORWARDING;
|
|
||||||
reason++) {
|
|
||||||
let options = {
|
|
||||||
reason: reason,
|
|
||||||
action: MozMobileConnection.CALL_FORWARD_ACTION_ERASURE
|
|
||||||
};
|
|
||||||
// Emulator doesn't support CALL_FORWARD_REASON_ALL_* yet, we catch the
|
|
||||||
// reject here in order to avoid impact the test result.
|
|
||||||
promise =
|
|
||||||
promise.then(() => setCallForwardingOption(options).then(null, () => {}));
|
|
||||||
}
|
|
||||||
return promise;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start tests
|
|
||||||
startTestCommon(function() {
|
|
||||||
let promise = Promise.resolve();
|
|
||||||
for (let i = 0; i < TEST_DATA.length; i++) {
|
|
||||||
let data = TEST_DATA[i];
|
|
||||||
promise = promise.then(() => testSetCallForwarding(data))
|
|
||||||
.then(() => testGetCallForwarding(data));
|
|
||||||
}
|
|
||||||
// reset call forwarding settings.
|
|
||||||
return promise.then(null, () => { ok(false, "promise reject during test"); })
|
|
||||||
.then(() => clearAllCallForwardingSettings());
|
|
||||||
});
|
|
|
@ -1,111 +0,0 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
|
||||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
||||||
|
|
||||||
MARIONETTE_TIMEOUT = 60000;
|
|
||||||
MARIONETTE_HEAD_JS = "head.js";
|
|
||||||
|
|
||||||
// PIN is hardcoded as "0000" by default.
|
|
||||||
// See it here {B2G_HOME}/external/qemu/telephony/sim_card.c,
|
|
||||||
// in asimcard_create().
|
|
||||||
const TEST_DATA = [
|
|
||||||
// Test passing no pin.
|
|
||||||
{
|
|
||||||
pin: "",
|
|
||||||
newPin: "0000",
|
|
||||||
newPinAgain: "1111",
|
|
||||||
expectedError: {
|
|
||||||
name: "emMmiError",
|
|
||||||
additionalInformation: null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// Test passing no newPin.
|
|
||||||
{
|
|
||||||
pin: "0000",
|
|
||||||
newPin: "",
|
|
||||||
newPinAgain: "",
|
|
||||||
expectedError: {
|
|
||||||
name: "emMmiError",
|
|
||||||
additionalInformation: null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// Test passing mismatched newPin.
|
|
||||||
{
|
|
||||||
pin: "0000",
|
|
||||||
newPin: "0000",
|
|
||||||
newPinAgain: "1111",
|
|
||||||
expectedError: {
|
|
||||||
name: "emMmiErrorMismatchPin",
|
|
||||||
additionalInformation: null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// Test passing invalid pin (< 4 digit).
|
|
||||||
{
|
|
||||||
pin: "000",
|
|
||||||
newPin: "0000",
|
|
||||||
newPinAgain: "0000",
|
|
||||||
expectedError: {
|
|
||||||
name: "emMmiErrorInvalidPin",
|
|
||||||
additionalInformation: null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// Test passing invalid newPin (> 8 digit).
|
|
||||||
{
|
|
||||||
pin: "0000",
|
|
||||||
newPin: "000000000",
|
|
||||||
newPinAgain: "000000000",
|
|
||||||
expectedError: {
|
|
||||||
name: "emMmiErrorInvalidPin",
|
|
||||||
additionalInformation: null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// Test passing incorrect pin.
|
|
||||||
{
|
|
||||||
pin: "1234",
|
|
||||||
newPin: "0000",
|
|
||||||
newPinAgain: "0000",
|
|
||||||
expectedError: {
|
|
||||||
name: "emMmiErrorBadPin",
|
|
||||||
// The default pin retries is 3, failed once becomes to 2
|
|
||||||
additionalInformation: 2
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// Test changing pin successfully (Reset the retries).
|
|
||||||
{
|
|
||||||
pin: "0000",
|
|
||||||
newPin: "0000",
|
|
||||||
newPinAgain: "0000"
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
function testChangePin(aPin, aNewPin, aNewPinAgain, aExpectedError) {
|
|
||||||
let MMI_CODE = "**04*" + aPin + "*" + aNewPin + "*" + aNewPinAgain + "#";
|
|
||||||
log("Test " + MMI_CODE);
|
|
||||||
|
|
||||||
return sendMMI(MMI_CODE)
|
|
||||||
.then(function resolve(aResult) {
|
|
||||||
ok(!aExpectedError, MMI_CODE + " success");
|
|
||||||
is(aResult.serviceCode, "scPin", "Check service code");
|
|
||||||
is(aResult.statusMessage, "smPinChanged", "Check status message");
|
|
||||||
is(aResult.additionalInformation, undefined, "Check additional information");
|
|
||||||
}, function reject(aError) {
|
|
||||||
ok(aExpectedError, MMI_CODE + " fail");
|
|
||||||
is(aError.name, aExpectedError.name, "Check name");
|
|
||||||
is(aError.message, "", "Check message");
|
|
||||||
is(aError.serviceCode, "scPin", "Check service code");
|
|
||||||
is(aError.additionalInformation, aExpectedError.additionalInformation,
|
|
||||||
"Chech additional information");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start test
|
|
||||||
startTestCommon(function() {
|
|
||||||
let promise = Promise.resolve();
|
|
||||||
for (let i = 0; i < TEST_DATA.length; i++) {
|
|
||||||
let data = TEST_DATA[i];
|
|
||||||
promise = promise.then(() => testChangePin(data.pin,
|
|
||||||
data.newPin,
|
|
||||||
data.newPinAgain,
|
|
||||||
data.expectedError));
|
|
||||||
}
|
|
||||||
return promise;
|
|
||||||
});
|
|
|
@ -49,8 +49,6 @@ if (!SpecialPowers.hasPermission("mobileconnection", document)) {
|
||||||
is("getRoamingPreference" in mobileConnection, true, "getRoamingPreference");
|
is("getRoamingPreference" in mobileConnection, true, "getRoamingPreference");
|
||||||
is("setVoicePrivacyMode" in mobileConnection, true, "setVoicePrivacyMode");
|
is("setVoicePrivacyMode" in mobileConnection, true, "setVoicePrivacyMode");
|
||||||
is("getVoicePrivacyMode" in mobileConnection, true, "getVoicePrivacyMode");
|
is("getVoicePrivacyMode" in mobileConnection, true, "getVoicePrivacyMode");
|
||||||
is("sendMMI" in mobileConnection, true, "sendMMI");
|
|
||||||
is("cancelMMI" in mobileConnection, true, "cancelMMI");
|
|
||||||
is("setCallForwardingOption" in mobileConnection, true, "setCallForwardingOption");
|
is("setCallForwardingOption" in mobileConnection, true, "setCallForwardingOption");
|
||||||
is("getCallForwardingOption" in mobileConnection, true, "getCallForwardingOption");
|
is("getCallForwardingOption" in mobileConnection, true, "getCallForwardingOption");
|
||||||
is("setCallBarringOption" in mobileConnection, true, "setCallBarringOption");
|
is("setCallBarringOption" in mobileConnection, true, "setCallBarringOption");
|
||||||
|
|
|
@ -49,8 +49,6 @@ if (!SpecialPowers.hasPermission("mobilenetwork", document)) {
|
||||||
is("getRoamingPreference" in mobileConnection, false, "getRoamingPreference");
|
is("getRoamingPreference" in mobileConnection, false, "getRoamingPreference");
|
||||||
is("setVoicePrivacyMode" in mobileConnection, false, "setVoicePrivacyMode");
|
is("setVoicePrivacyMode" in mobileConnection, false, "setVoicePrivacyMode");
|
||||||
is("getVoicePrivacyMode" in mobileConnection, false, "getVoicePrivacyMode");
|
is("getVoicePrivacyMode" in mobileConnection, false, "getVoicePrivacyMode");
|
||||||
is("sendMMI" in mobileConnection, false, "sendMMI");
|
|
||||||
is("cancelMMI" in mobileConnection, false, "cancelMMI");
|
|
||||||
is("setCallForwardingOption" in mobileConnection, false, "setCallForwardingOption");
|
is("setCallForwardingOption" in mobileConnection, false, "setCallForwardingOption");
|
||||||
is("getCallForwardingOption" in mobileConnection, false, "getCallForwardingOption");
|
is("getCallForwardingOption" in mobileConnection, false, "getCallForwardingOption");
|
||||||
is("setCallBarringOption" in mobileConnection, false, "setCallBarringOption");
|
is("setCallBarringOption" in mobileConnection, false, "setCallBarringOption");
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
let Ci = Components.interfaces;
|
||||||
|
let Cc = Components.classes;
|
||||||
|
let Cu = Components.utils;
|
||||||
|
|
||||||
|
// Stolen from SpecialPowers, since at this point we don't know we're in a test.
|
||||||
|
let isMainProcess = function() {
|
||||||
|
try {
|
||||||
|
return Cc["@mozilla.org/xre/app-info;1"].
|
||||||
|
getService(Ci.nsIXULRuntime).
|
||||||
|
processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
|
||||||
|
} catch (e) { }
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (isMainProcess()) {
|
||||||
|
Components.utils.import("resource://gre/modules/SettingsRequestManager.jsm");
|
||||||
|
}
|
|
@ -1,5 +1,7 @@
|
||||||
[DEFAULT]
|
[DEFAULT]
|
||||||
skip-if = (toolkit == 'gonk' && debug) || e10s #debug-only failure, bug 932878
|
skip-if = (toolkit == 'gonk' && debug) #debug-only failure, bug 932878
|
||||||
|
support-files =
|
||||||
|
file_loadserver.js
|
||||||
|
|
||||||
[test_settings_basics.html]
|
[test_settings_basics.html]
|
||||||
[test_settings_permissions.html]
|
[test_settings_permissions.html]
|
||||||
|
|
|
@ -21,10 +21,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id={678695}
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
if (SpecialPowers.isMainProcess()) {
|
var url = SimpleTest.getTestFileURL("file_loadserver.js");
|
||||||
SpecialPowers.Cu.import("resource://gre/modules/SettingsRequestManager.jsm");
|
var script = SpecialPowers.loadChromeScript(url);
|
||||||
}
|
|
||||||
|
|
||||||
SpecialPowers.addPermission("settings-api-read", true, document);
|
SpecialPowers.addPermission("settings-api-read", true, document);
|
||||||
SpecialPowers.addPermission("settings-api-write", true, document);
|
SpecialPowers.addPermission("settings-api-write", true, document);
|
||||||
SpecialPowers.addPermission("settings-read", true, document);
|
SpecialPowers.addPermission("settings-read", true, document);
|
||||||
|
@ -99,12 +97,10 @@ function check(o1, o2) {
|
||||||
var req, req2, req3, req4, req5, req6;
|
var req, req2, req3, req4, req5, req6;
|
||||||
var index = 0;
|
var index = 0;
|
||||||
|
|
||||||
var mozSettings = navigator.mozSettings;
|
|
||||||
|
|
||||||
var steps = [
|
var steps = [
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Deleting database");
|
ok(true, "Deleting database");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.clear();
|
req = lock.clear();
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "Deleted the database");
|
ok(true, "Deleted the database");
|
||||||
|
@ -113,14 +109,14 @@ var steps = [
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Setting wifi");
|
ok(true, "Setting wifi");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.set(wifi);
|
req = lock.set(wifi);
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "set done");
|
ok(true, "set done");
|
||||||
}
|
}
|
||||||
req.onerror = onFailure;
|
req.onerror = onFailure;
|
||||||
|
|
||||||
var lock2 = mozSettings.createLock();
|
var lock2 = navigator.mozSettings.createLock();
|
||||||
req2 = lock2.get("net3g.apn");
|
req2 = lock2.get("net3g.apn");
|
||||||
req2.onsuccess = function () {
|
req2.onsuccess = function () {
|
||||||
is(Object.keys(req2.result).length, 1, "length 1");
|
is(Object.keys(req2.result).length, 1, "length 1");
|
||||||
|
@ -132,7 +128,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Change wifi1");
|
ok(true, "Change wifi1");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.set(wifi2);
|
req = lock.set(wifi2);
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "Set Done");
|
ok(true, "Set Done");
|
||||||
|
@ -150,7 +146,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Set Combination");
|
ok(true, "Set Combination");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req3 = lock.set(combination);
|
req3 = lock.set(combination);
|
||||||
req3.onsuccess = function () {
|
req3.onsuccess = function () {
|
||||||
ok(true, "set done");
|
ok(true, "set done");
|
||||||
|
@ -164,7 +160,7 @@ var steps = [
|
||||||
req3.onerror = onFailure;
|
req3.onerror = onFailure;
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req4 = lock.get("net3g.apn2");
|
req4 = lock.get("net3g.apn2");
|
||||||
req4.onsuccess = function() {
|
req4.onsuccess = function() {
|
||||||
ok(true, "Done");
|
ok(true, "Done");
|
||||||
|
@ -175,7 +171,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
ok(true, "Get unknown key");
|
ok(true, "Get unknown key");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.get("abc.def");
|
req = lock.get("abc.def");
|
||||||
req.onsuccess = function() {
|
req.onsuccess = function() {
|
||||||
is(req.result["abc.def"], undefined, "no result");
|
is(req.result["abc.def"], undefined, "no result");
|
||||||
|
@ -186,7 +182,7 @@ var steps = [
|
||||||
function() {
|
function() {
|
||||||
ok(true, "adding onsettingchange");
|
ok(true, "adding onsettingchange");
|
||||||
navigator.mozSettings.onsettingchange = onsettingschangeWithNext;
|
navigator.mozSettings.onsettingchange = onsettingschangeWithNext;
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req2 = lock.get("screen.brightness");
|
req2 = lock.get("screen.brightness");
|
||||||
req2.onsuccess = function() {
|
req2.onsuccess = function() {
|
||||||
ok(true, "end adding onsettingchange");
|
ok(true, "end adding onsettingchange");
|
||||||
|
@ -196,7 +192,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
ok(true, "Test onsettingchange");
|
ok(true, "Test onsettingchange");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.set(screenBright);
|
req = lock.set(screenBright);
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "set done, observer has to call next");
|
ok(true, "set done, observer has to call next");
|
||||||
|
@ -205,7 +201,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
ok(true, "delete onsettingschange");
|
ok(true, "delete onsettingschange");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
navigator.mozSettings.onsettingchange = null;
|
navigator.mozSettings.onsettingchange = null;
|
||||||
req = lock.set(screenBright);
|
req = lock.set(screenBright);
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
|
@ -216,7 +212,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Waiting for all set callbacks");
|
ok(true, "Waiting for all set callbacks");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.get("screen.brightness");
|
req = lock.get("screen.brightness");
|
||||||
req.onsuccess = function() {
|
req.onsuccess = function() {
|
||||||
ok(true, "Done");
|
ok(true, "Done");
|
||||||
|
@ -230,7 +226,7 @@ var steps = [
|
||||||
navigator.mozSettings.addObserver("screen.brightness", observer1);
|
navigator.mozSettings.addObserver("screen.brightness", observer1);
|
||||||
navigator.mozSettings.addObserver("screen.brightness", observer2);
|
navigator.mozSettings.addObserver("screen.brightness", observer2);
|
||||||
navigator.mozSettings.addObserver("screen.brightness", observerWithNext);
|
navigator.mozSettings.addObserver("screen.brightness", observerWithNext);
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req2 = lock.get("screen.brightness");
|
req2 = lock.get("screen.brightness");
|
||||||
req2.onsuccess = function() {
|
req2.onsuccess = function() {
|
||||||
ok(true, "set observeSetting done!");
|
ok(true, "set observeSetting done!");
|
||||||
|
@ -240,7 +236,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
ok(true, "test observers");
|
ok(true, "test observers");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.set(screenBright);
|
req = lock.set(screenBright);
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "set done");
|
ok(true, "set done");
|
||||||
|
@ -249,7 +245,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
ok(true, "removing Event Listener");
|
ok(true, "removing Event Listener");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.set(screenBright);
|
req = lock.set(screenBright);
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "set done");
|
ok(true, "set done");
|
||||||
|
@ -260,7 +256,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
ok(true, "test Event Listener");
|
ok(true, "test Event Listener");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.set(screenBright);
|
req = lock.set(screenBright);
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "set done");
|
ok(true, "set done");
|
||||||
|
@ -269,7 +265,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
ok(true, "removing Event Listener");
|
ok(true, "removing Event Listener");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
navigator.mozSettings.removeObserver("screen.brightness", observerWithNext);
|
navigator.mozSettings.removeObserver("screen.brightness", observerWithNext);
|
||||||
req = lock.set(screenBright);
|
req = lock.set(screenBright);
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
|
@ -282,7 +278,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
ok(true, "removing Event Listener");
|
ok(true, "removing Event Listener");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.get("screen.brightness");
|
req = lock.get("screen.brightness");
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "get done");
|
ok(true, "get done");
|
||||||
|
@ -292,7 +288,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Nested test");
|
ok(true, "Nested test");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.get("screen.brightness");
|
req = lock.get("screen.brightness");
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
req3 = lock.set({"screen.brightness": req.result["screen.brightness"] + 1})
|
req3 = lock.set({"screen.brightness": req.result["screen.brightness"] + 1})
|
||||||
|
@ -313,7 +309,7 @@ var steps = [
|
||||||
}
|
}
|
||||||
req2.onerror = onFailure;
|
req2.onerror = onFailure;
|
||||||
|
|
||||||
var lock2 = mozSettings.createLock();
|
var lock2 = navigator.mozSettings.createLock();
|
||||||
req5 = lock2.get("screen.brightness");
|
req5 = lock2.get("screen.brightness");
|
||||||
req5.onsuccess = function () {
|
req5.onsuccess = function () {
|
||||||
is(req5.result["screen.brightness"], 1.7, "same Value");
|
is(req5.result["screen.brightness"], 1.7, "same Value");
|
||||||
|
@ -323,7 +319,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Deleting database");
|
ok(true, "Deleting database");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.clear();
|
req = lock.clear();
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "Deleted the database");
|
ok(true, "Deleted the database");
|
||||||
|
@ -331,7 +327,7 @@ var steps = [
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req2 = lock.set(wifi);
|
req2 = lock.set(wifi);
|
||||||
req2.onsuccess = function () {
|
req2.onsuccess = function () {
|
||||||
ok(true, "set done");
|
ok(true, "set done");
|
||||||
|
@ -339,7 +335,7 @@ var steps = [
|
||||||
req2.onerror = onFailure;
|
req2.onerror = onFailure;
|
||||||
|
|
||||||
ok(true, "Get all settings");
|
ok(true, "Get all settings");
|
||||||
var lock2 = mozSettings.createLock();
|
var lock2 = navigator.mozSettings.createLock();
|
||||||
req3 = lock2.get("*");
|
req3 = lock2.get("*");
|
||||||
req3.onsuccess = function () {
|
req3.onsuccess = function () {
|
||||||
is(Object.keys(req3.result).length, 1, "length 1");
|
is(Object.keys(req3.result).length, 1, "length 1");
|
||||||
|
@ -360,7 +356,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Change wifi1");
|
ok(true, "Change wifi1");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.set(wifi2);
|
req = lock.set(wifi2);
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "Set Done");
|
ok(true, "Set Done");
|
||||||
|
@ -379,8 +375,8 @@ var steps = [
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Test locking");
|
ok(true, "Test locking");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
var lock2 = mozSettings.createLock();
|
var lock2 = navigator.mozSettings.createLock();
|
||||||
req = lock.set(wifiEnabled);
|
req = lock.set(wifiEnabled);
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "Test Locking Done");
|
ok(true, "Test Locking Done");
|
||||||
|
@ -396,7 +392,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Test locking result");
|
ok(true, "Test locking result");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.get("wifi.enabled");
|
req = lock.get("wifi.enabled");
|
||||||
req.onsuccess = function() {
|
req.onsuccess = function() {
|
||||||
check(req.result, wifiDisabled);
|
check(req.result, wifiDisabled);
|
||||||
|
@ -409,7 +405,7 @@ var steps = [
|
||||||
ok(true, "Test locking heavy");
|
ok(true, "Test locking heavy");
|
||||||
for (var i=0; i<30; i++) {
|
for (var i=0; i<30; i++) {
|
||||||
// only new locks!
|
// only new locks!
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
var obj = {};
|
var obj = {};
|
||||||
obj["wifi.enabled" + i] = true;
|
obj["wifi.enabled" + i] = true;
|
||||||
req = lock.set( obj );
|
req = lock.set( obj );
|
||||||
|
@ -419,7 +415,7 @@ var steps = [
|
||||||
req.onerror = onFailure;
|
req.onerror = onFailure;
|
||||||
};
|
};
|
||||||
{
|
{
|
||||||
var lock2 = mozSettings.createLock();
|
var lock2 = navigator.mozSettings.createLock();
|
||||||
req2 = lock2.get("*");
|
req2 = lock2.get("*");
|
||||||
req2.onsuccess = function () {
|
req2.onsuccess = function () {
|
||||||
is(Object.keys(req2.result).length, 32, "length 12");
|
is(Object.keys(req2.result).length, 32, "length 12");
|
||||||
|
@ -428,7 +424,7 @@ var steps = [
|
||||||
};
|
};
|
||||||
req2.onerror = onFailure;
|
req2.onerror = onFailure;
|
||||||
}
|
}
|
||||||
var lock2 = mozSettings.createLock();
|
var lock2 = navigator.mozSettings.createLock();
|
||||||
var obj = {};
|
var obj = {};
|
||||||
obj["wifi.enabled" + 30] = true;
|
obj["wifi.enabled" + 30] = true;
|
||||||
req3 = lock2.set( obj );
|
req3 = lock2.set( obj );
|
||||||
|
@ -437,7 +433,7 @@ var steps = [
|
||||||
};
|
};
|
||||||
req3.onerror = onFailure;
|
req3.onerror = onFailure;
|
||||||
|
|
||||||
var lock3 = mozSettings.createLock();
|
var lock3 = navigator.mozSettings.createLock();
|
||||||
// with one lock
|
// with one lock
|
||||||
for (var i = 0; i < 30; i++) {
|
for (var i = 0; i < 30; i++) {
|
||||||
req4 = lock3.get("wifi.enabled" + i);
|
req4 = lock3.get("wifi.enabled" + i);
|
||||||
|
@ -451,7 +447,7 @@ var steps = [
|
||||||
}
|
}
|
||||||
|
|
||||||
ok(true, "start next2!");
|
ok(true, "start next2!");
|
||||||
var lock4 = mozSettings.createLock();
|
var lock4 = navigator.mozSettings.createLock();
|
||||||
for (var i=0; i<30; i++) {
|
for (var i=0; i<30; i++) {
|
||||||
var obj = {};
|
var obj = {};
|
||||||
obj["wifi.enabled" + i] = false;
|
obj["wifi.enabled" + i] = false;
|
||||||
|
@ -461,7 +457,7 @@ var steps = [
|
||||||
};
|
};
|
||||||
req4.onerror = onFailure;
|
req4.onerror = onFailure;
|
||||||
}
|
}
|
||||||
var lock5 = mozSettings.createLock();
|
var lock5 = navigator.mozSettings.createLock();
|
||||||
for (var i=0; i<30; i++) {
|
for (var i=0; i<30; i++) {
|
||||||
req5 = lock5.get("wifi.enabled" + i);
|
req5 = lock5.get("wifi.enabled" + i);
|
||||||
var testObj = {};
|
var testObj = {};
|
||||||
|
@ -473,7 +469,7 @@ var steps = [
|
||||||
req5.onerror = onFailure;
|
req5.onerror = onFailure;
|
||||||
}
|
}
|
||||||
|
|
||||||
var lock6 = mozSettings.createLock();
|
var lock6 = navigator.mozSettings.createLock();
|
||||||
req6 = lock6.clear();
|
req6 = lock6.clear();
|
||||||
req6.onsuccess = function () {
|
req6.onsuccess = function () {
|
||||||
ok(true, "Deleted the database");
|
ok(true, "Deleted the database");
|
||||||
|
@ -483,8 +479,8 @@ var steps = [
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
ok(true, "reverse Test locking");
|
ok(true, "reverse Test locking");
|
||||||
var lock2 = mozSettings.createLock();
|
var lock2 = navigator.mozSettings.createLock();
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
|
|
||||||
req = lock.set(wifiEnabled);
|
req = lock.set(wifiEnabled);
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
|
@ -501,7 +497,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Test locking result");
|
ok(true, "Test locking result");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
|
|
||||||
req = lock.get("wifi.enabled");
|
req = lock.get("wifi.enabled");
|
||||||
req.onsuccess = function() {
|
req.onsuccess = function() {
|
||||||
|
@ -510,14 +506,14 @@ var steps = [
|
||||||
}
|
}
|
||||||
req.onerror = onFailure;
|
req.onerror = onFailure;
|
||||||
|
|
||||||
var lock2 = mozSettings.createLock();
|
var lock2 = navigator.mozSettings.createLock();
|
||||||
req2 = lock2.clear();
|
req2 = lock2.clear();
|
||||||
req2.onsuccess = function () {
|
req2.onsuccess = function () {
|
||||||
ok(true, "Deleted the database");
|
ok(true, "Deleted the database");
|
||||||
};
|
};
|
||||||
req2.onerror = onFailure;
|
req2.onerror = onFailure;
|
||||||
|
|
||||||
var lock3 = mozSettings.createLock();
|
var lock3 = navigator.mozSettings.createLock();
|
||||||
req3 = lock3.set(wifi);
|
req3 = lock3.set(wifi);
|
||||||
req3.onsuccess = function () {
|
req3.onsuccess = function () {
|
||||||
ok(true, "set done");
|
ok(true, "set done");
|
||||||
|
@ -528,7 +524,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Get all settings");
|
ok(true, "Get all settings");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.get("*");
|
req = lock.get("*");
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
is(Object.keys(req.result).length, 1, "length 1");
|
is(Object.keys(req.result).length, 1, "length 1");
|
||||||
|
@ -540,7 +536,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Get net3g.apn");
|
ok(true, "Get net3g.apn");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.get("net3g.apn");
|
req = lock.get("net3g.apn");
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
is(Object.keys(req.result).length, 1, "length 1");
|
is(Object.keys(req.result).length, 1, "length 1");
|
||||||
|
@ -552,7 +548,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Change wifi2");
|
ok(true, "Change wifi2");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.set(wifi2);
|
req = lock.set(wifi2);
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "Set Done");
|
ok(true, "Set Done");
|
||||||
|
@ -562,7 +558,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Get net3g.apn");
|
ok(true, "Get net3g.apn");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.get("net3g.apn");
|
req = lock.get("net3g.apn");
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
is(Object.keys(req.result).length, 1, "length 1");
|
is(Object.keys(req.result).length, 1, "length 1");
|
||||||
|
@ -574,7 +570,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Add wifi.enabled");
|
ok(true, "Add wifi.enabled");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.set(wifiEnabled);
|
req = lock.set(wifiEnabled);
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "Set Done");
|
ok(true, "Set Done");
|
||||||
|
@ -584,7 +580,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Get Wifi Enabled");
|
ok(true, "Get Wifi Enabled");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.get("wifi.enabled");
|
req = lock.get("wifi.enabled");
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
is(Object.keys(req.result).length, 1, "length 1");
|
is(Object.keys(req.result).length, 1, "length 1");
|
||||||
|
@ -596,7 +592,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Get all");
|
ok(true, "Get all");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.get("*");
|
req = lock.get("*");
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
is(Object.keys(req.result).length, 2, "length 2");
|
is(Object.keys(req.result).length, 2, "length 2");
|
||||||
|
@ -609,7 +605,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Add wifiNetworks");
|
ok(true, "Add wifiNetworks");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.set(wifiNetworks0);
|
req = lock.set(wifiNetworks0);
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "Set Done");
|
ok(true, "Set Done");
|
||||||
|
@ -625,7 +621,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Get Wifi Networks");
|
ok(true, "Get Wifi Networks");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.get("wifi.networks[0]");
|
req = lock.get("wifi.networks[0]");
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
is(Object.keys(req.result).length, 1, "length 1");
|
is(Object.keys(req.result).length, 1, "length 1");
|
||||||
|
@ -637,12 +633,12 @@ var steps = [
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
ok(true, "Clear DB, multiple locks");
|
ok(true, "Clear DB, multiple locks");
|
||||||
var lock4 = mozSettings.createLock();
|
var lock4 = navigator.mozSettings.createLock();
|
||||||
var lock3 = mozSettings.createLock();
|
var lock3 = navigator.mozSettings.createLock();
|
||||||
var lock2 = mozSettings.createLock();
|
var lock2 = navigator.mozSettings.createLock();
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
var lock6 = mozSettings.createLock();
|
var lock6 = navigator.mozSettings.createLock();
|
||||||
var lock7 = mozSettings.createLock();
|
var lock7 = navigator.mozSettings.createLock();
|
||||||
req = lock.clear();
|
req = lock.clear();
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "Deleted the database");
|
ok(true, "Deleted the database");
|
||||||
|
@ -652,7 +648,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Add wifiNetworks");
|
ok(true, "Add wifiNetworks");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.set(wifiNetworks0);
|
req = lock.set(wifiNetworks0);
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "Set Done");
|
ok(true, "Set Done");
|
||||||
|
@ -662,7 +658,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Test set after lock closed");
|
ok(true, "Test set after lock closed");
|
||||||
var lockx = mozSettings.createLock();
|
var lockx = navigator.mozSettings.createLock();
|
||||||
var cb = function() {
|
var cb = function() {
|
||||||
var reqx = null;
|
var reqx = null;
|
||||||
try {
|
try {
|
||||||
|
@ -678,7 +674,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
ok(true, "Clear DB");
|
ok(true, "Clear DB");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.clear();
|
req = lock.clear();
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "Deleted the database");
|
ok(true, "Deleted the database");
|
||||||
|
@ -688,7 +684,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
ok(true, "Set with multiple arguments");
|
ok(true, "Set with multiple arguments");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.set(combination);
|
req = lock.set(combination);
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "Set Done");
|
ok(true, "Set Done");
|
||||||
|
@ -698,7 +694,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
ok(true, "request argument from multiple set");
|
ok(true, "request argument from multiple set");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.get("screen.brightness");
|
req = lock.get("screen.brightness");
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
check(req.result["screen.brightness"], 0.7, "get done");
|
check(req.result["screen.brightness"], 0.7, "get done");
|
||||||
|
@ -708,7 +704,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
ok(true, "Test closed attribute on a valid lock");
|
ok(true, "Test closed attribute on a valid lock");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
is(lock.closed, false, "closed attribute is false on creation");
|
is(lock.closed, false, "closed attribute is false on creation");
|
||||||
req = lock.get("screen.brightness");
|
req = lock.get("screen.brightness");
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
|
@ -719,7 +715,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Test closed attribute on invalid lock");
|
ok(true, "Test closed attribute on invalid lock");
|
||||||
var lockx = mozSettings.createLock();
|
var lockx = navigator.mozSettings.createLock();
|
||||||
var cb = function() {
|
var cb = function() {
|
||||||
var reqx = null;
|
var reqx = null;
|
||||||
try {
|
try {
|
||||||
|
@ -735,7 +731,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
ok(true, "Clear DB");
|
ok(true, "Clear DB");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.clear();
|
req = lock.clear();
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "Deleted the database");
|
ok(true, "Deleted the database");
|
||||||
|
@ -745,7 +741,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
ok(true, "Set object value");
|
ok(true, "Set object value");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.set({"setting-obj": {foo: {bar: 23}}});
|
req = lock.set({"setting-obj": {foo: {bar: 23}}});
|
||||||
req.onsuccess = function() {
|
req.onsuccess = function() {
|
||||||
req2 = lock.get("setting-obj");
|
req2 = lock.get("setting-obj");
|
||||||
|
@ -761,7 +757,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
ok(true, "Clear DB");
|
ok(true, "Clear DB");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.clear();
|
req = lock.clear();
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "Deleted the database");
|
ok(true, "Deleted the database");
|
||||||
|
@ -771,7 +767,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Call success callback when transaction commits");
|
ok(true, "Call success callback when transaction commits");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
lock.onsettingstransactionsuccess = function () {
|
lock.onsettingstransactionsuccess = function () {
|
||||||
next();
|
next();
|
||||||
};
|
};
|
||||||
|
@ -789,7 +785,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
ok(true, "Clear DB");
|
ok(true, "Clear DB");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.clear();
|
req = lock.clear();
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "Deleted the database");
|
ok(true, "Deleted the database");
|
||||||
|
|
|
@ -21,10 +21,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=821630
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
if (SpecialPowers.isMainProcess()) {
|
var url = SimpleTest.getTestFileURL("file_loadserver.js");
|
||||||
SpecialPowers.Cu.import("resource://gre/modules/SettingsRequestManager.jsm");
|
var script = SpecialPowers.loadChromeScript(url);
|
||||||
}
|
|
||||||
|
|
||||||
SpecialPowers.addPermission("settings-read", true, document);
|
SpecialPowers.addPermission("settings-read", true, document);
|
||||||
SpecialPowers.addPermission("settings-write", true, document);
|
SpecialPowers.addPermission("settings-write", true, document);
|
||||||
SpecialPowers.addPermission("settings-api-read", true, document);
|
SpecialPowers.addPermission("settings-api-read", true, document);
|
||||||
|
@ -45,7 +43,6 @@ function onFailure() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mozSettings = window.navigator.mozSettings;
|
|
||||||
let req;
|
let req;
|
||||||
|
|
||||||
let storedBlob = new Blob(['12345'], {"type": "text/plain"});
|
let storedBlob = new Blob(['12345'], {"type": "text/plain"});
|
||||||
|
@ -61,7 +58,7 @@ function checkBlob(blob) {
|
||||||
|
|
||||||
let steps = [
|
let steps = [
|
||||||
function() {
|
function() {
|
||||||
let lock = mozSettings.createLock();
|
let lock = navigator.mozSettings.createLock();
|
||||||
req = lock.clear();
|
req = lock.clear();
|
||||||
req.onsuccess = next;
|
req.onsuccess = next;
|
||||||
req.onerror = onFailure("Deleting database");
|
req.onerror = onFailure("Deleting database");
|
||||||
|
@ -69,19 +66,19 @@ let steps = [
|
||||||
function() {
|
function() {
|
||||||
function obs(e) {
|
function obs(e) {
|
||||||
checkBlob(e.settingValue);
|
checkBlob(e.settingValue);
|
||||||
mozSettings.removeObserver("test1", obs);
|
navigator.mozSettings.removeObserver("test1", obs);
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
mozSettings.addObserver("test1", obs);
|
navigator.mozSettings.addObserver("test1", obs);
|
||||||
next();
|
next();
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
// next is called by the observer above
|
// next is called by the observer above
|
||||||
let req = mozSettings.createLock().set({"test1": storedBlob});
|
let req = navigator.mozSettings.createLock().set({"test1": storedBlob});
|
||||||
req.onerror = onFailure("Saving blob");
|
req.onerror = onFailure("Saving blob");
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
let req = mozSettings.createLock().get("test1");
|
let req = navigator.mozSettings.createLock().get("test1");
|
||||||
req.onsuccess = function(event) {
|
req.onsuccess = function(event) {
|
||||||
checkBlob(event.target.result["test1"]);
|
checkBlob(event.target.result["test1"]);
|
||||||
next();
|
next();
|
||||||
|
@ -89,12 +86,12 @@ let steps = [
|
||||||
req.onerror = onFailure("Getting blob");
|
req.onerror = onFailure("Getting blob");
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
let req = mozSettings.createLock().set({"test2": [1, 2, storedBlob, 4]});
|
let req = navigator.mozSettings.createLock().set({"test2": [1, 2, storedBlob, 4]});
|
||||||
req.onsuccess = next;
|
req.onsuccess = next;
|
||||||
req.onerror = onFailure("Saving array");
|
req.onerror = onFailure("Saving array");
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
let req = mozSettings.createLock().get("test2");
|
let req = navigator.mozSettings.createLock().get("test2");
|
||||||
req.onsuccess = function(event) {
|
req.onsuccess = function(event) {
|
||||||
let val = event.target.result["test2"];
|
let val = event.target.result["test2"];
|
||||||
ok(Array.isArray(val), "Result is an array");
|
ok(Array.isArray(val), "Result is an array");
|
||||||
|
@ -105,12 +102,12 @@ let steps = [
|
||||||
req.onerror = onFailure("Getting array");
|
req.onerror = onFailure("Getting array");
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
let req = mozSettings.createLock().set({"test3": {foo: "bar", baz: {number: 1, arr: [storedBlob]}}});
|
let req = navigator.mozSettings.createLock().set({"test3": {foo: "bar", baz: {number: 1, arr: [storedBlob]}}});
|
||||||
req.onsuccess = next();
|
req.onsuccess = next();
|
||||||
req.onerror = onFailure("Saving object");
|
req.onerror = onFailure("Saving object");
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
let req = mozSettings.createLock().get("test3");
|
let req = navigator.mozSettings.createLock().get("test3");
|
||||||
req.onsuccess = function(event) {
|
req.onsuccess = function(event) {
|
||||||
let val = event.target.result["test3"];
|
let val = event.target.result["test3"];
|
||||||
ok(typeof(val) == "object", "Result is an object");
|
ok(typeof(val) == "object", "Result is an object");
|
||||||
|
@ -125,7 +122,7 @@ let steps = [
|
||||||
req.onerror = onFailure("Getting object");
|
req.onerror = onFailure("Getting object");
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
let req = mozSettings.createLock().clear();
|
let req = navigator.mozSettings.createLock().clear();
|
||||||
req.onsuccess = function() {
|
req.onsuccess = function() {
|
||||||
next();
|
next();
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,10 +21,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=806374
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
if (SpecialPowers.isMainProcess()) {
|
var url = SimpleTest.getTestFileURL("file_loadserver.js");
|
||||||
SpecialPowers.Cu.import("resource://gre/modules/SettingsRequestManager.jsm");
|
var script = SpecialPowers.loadChromeScript(url);
|
||||||
}
|
|
||||||
|
|
||||||
SpecialPowers.addPermission("settings-read", true, document);
|
SpecialPowers.addPermission("settings-read", true, document);
|
||||||
SpecialPowers.addPermission("settings-write", true, document);
|
SpecialPowers.addPermission("settings-write", true, document);
|
||||||
SpecialPowers.addPermission("settings-api-read", true, document);
|
SpecialPowers.addPermission("settings-api-read", true, document);
|
||||||
|
@ -45,7 +43,6 @@ function onFailure() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mozSettings = window.navigator.mozSettings;
|
|
||||||
let req;
|
let req;
|
||||||
|
|
||||||
// A simple data URI that will be converted to a blob.
|
// A simple data URI that will be converted to a blob.
|
||||||
|
@ -62,7 +59,7 @@ function checkBlob(blob) {
|
||||||
|
|
||||||
let steps = [
|
let steps = [
|
||||||
function() {
|
function() {
|
||||||
let lock = mozSettings.createLock();
|
let lock = navigator.mozSettings.createLock();
|
||||||
req = lock.clear();
|
req = lock.clear();
|
||||||
req.onsuccess = next;
|
req.onsuccess = next;
|
||||||
req.onerror = onFailure("Deleting database");
|
req.onerror = onFailure("Deleting database");
|
||||||
|
@ -70,19 +67,19 @@ let steps = [
|
||||||
function() {
|
function() {
|
||||||
function obs(e) {
|
function obs(e) {
|
||||||
checkBlob(e.settingValue);
|
checkBlob(e.settingValue);
|
||||||
mozSettings.removeObserver("test1", obs);
|
navigator.mozSettings.removeObserver("test1", obs);
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
mozSettings.addObserver("test1", obs);
|
navigator.mozSettings.addObserver("test1", obs);
|
||||||
next();
|
next();
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
// next is called by the observer above
|
// next is called by the observer above
|
||||||
let req = mozSettings.createLock().set({"test1": dataURI});
|
let req = navigator.mozSettings.createLock().set({"test1": dataURI});
|
||||||
req.onerror = onFailure("Saving blob");
|
req.onerror = onFailure("Saving blob");
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
let req = mozSettings.createLock().get("test1");
|
let req = navigator.mozSettings.createLock().get("test1");
|
||||||
req.onsuccess = function(event) {
|
req.onsuccess = function(event) {
|
||||||
checkBlob(event.target.result["test1"]);
|
checkBlob(event.target.result["test1"]);
|
||||||
next();
|
next();
|
||||||
|
@ -90,12 +87,12 @@ let steps = [
|
||||||
req.onerror = onFailure("Getting blob");
|
req.onerror = onFailure("Getting blob");
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
let req = mozSettings.createLock().set({"test2": [1, 2, dataURI, 4]});
|
let req = navigator.mozSettings.createLock().set({"test2": [1, 2, dataURI, 4]});
|
||||||
req.onsuccess = next;
|
req.onsuccess = next;
|
||||||
req.onerror = onFailure("Saving array");
|
req.onerror = onFailure("Saving array");
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
let req = mozSettings.createLock().get("test2");
|
let req = navigator.mozSettings.createLock().get("test2");
|
||||||
req.onsuccess = function(event) {
|
req.onsuccess = function(event) {
|
||||||
let val = event.target.result["test2"];
|
let val = event.target.result["test2"];
|
||||||
ok(Array.isArray(val), "Result is an array");
|
ok(Array.isArray(val), "Result is an array");
|
||||||
|
@ -106,12 +103,12 @@ let steps = [
|
||||||
req.onerror = onFailure("Getting array");
|
req.onerror = onFailure("Getting array");
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
let req = mozSettings.createLock().set({"test3": {foo: "bar", baz: {number: 1, arr: [dataURI]}}});
|
let req = navigator.mozSettings.createLock().set({"test3": {foo: "bar", baz: {number: 1, arr: [dataURI]}}});
|
||||||
req.onsuccess = next();
|
req.onsuccess = next();
|
||||||
req.onerror = onFailure("Saving object");
|
req.onerror = onFailure("Saving object");
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
let req = mozSettings.createLock().get("test3");
|
let req = navigator.mozSettings.createLock().get("test3");
|
||||||
req.onsuccess = function(event) {
|
req.onsuccess = function(event) {
|
||||||
let val = event.target.result["test3"];
|
let val = event.target.result["test3"];
|
||||||
ok(typeof(val) == "object", "Result is an object");
|
ok(typeof(val) == "object", "Result is an object");
|
||||||
|
@ -126,7 +123,7 @@ let steps = [
|
||||||
req.onerror = onFailure("Getting object");
|
req.onerror = onFailure("Getting object");
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
let req = mozSettings.createLock().clear();
|
let req = navigator.mozSettings.createLock().clear();
|
||||||
req.onsuccess = function() {
|
req.onsuccess = function() {
|
||||||
next();
|
next();
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,10 +21,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=678695
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
if (SpecialPowers.isMainProcess()) {
|
var url = SimpleTest.getTestFileURL("file_loadserver.js");
|
||||||
SpecialPowers.Cu.import("resource://gre/modules/SettingsRequestManager.jsm");
|
var script = SpecialPowers.loadChromeScript(url);
|
||||||
}
|
|
||||||
|
|
||||||
SpecialPowers.addPermission("settings-write", true, document);
|
SpecialPowers.addPermission("settings-write", true, document);
|
||||||
SpecialPowers.addPermission("settings-read", true, document);
|
SpecialPowers.addPermission("settings-read", true, document);
|
||||||
SpecialPowers.addPermission("settings-api-read", true, document);
|
SpecialPowers.addPermission("settings-api-read", true, document);
|
||||||
|
@ -83,12 +81,10 @@ function onComplexSettingschangeWithNext(event) {
|
||||||
var req, req2;
|
var req, req2;
|
||||||
var index = 0;
|
var index = 0;
|
||||||
|
|
||||||
var mozSettings = window.navigator.mozSettings;
|
|
||||||
|
|
||||||
var steps = [
|
var steps = [
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Deleting database");
|
ok(true, "Deleting database");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.clear();
|
req = lock.clear();
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "Deleted the database");
|
ok(true, "Deleted the database");
|
||||||
|
@ -97,7 +93,7 @@ var steps = [
|
||||||
req.onerror = onFailure;
|
req.onerror = onFailure;
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req2 = lock.set(screenBright);
|
req2 = lock.set(screenBright);
|
||||||
req2.onsuccess = function () {
|
req2.onsuccess = function () {
|
||||||
ok(true, "set done");
|
ok(true, "set done");
|
||||||
|
@ -108,7 +104,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
ok(true, "testing");
|
ok(true, "testing");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req2 = lock.set(screenBright);
|
req2 = lock.set(screenBright);
|
||||||
req2.onsuccess = function() {
|
req2.onsuccess = function() {
|
||||||
ok(true, "end adding onsettingchange");
|
ok(true, "end adding onsettingchange");
|
||||||
|
@ -117,7 +113,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
ok(true, "test observers");
|
ok(true, "test observers");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.get("screen.brightness");
|
req = lock.get("screen.brightness");
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "get done");
|
ok(true, "get done");
|
||||||
|
@ -131,7 +127,7 @@ var steps = [
|
||||||
navigator.mozSettings.addObserver("screen.brightness", observer1);
|
navigator.mozSettings.addObserver("screen.brightness", observer1);
|
||||||
navigator.mozSettings.addObserver("screen.brightness", observer2);
|
navigator.mozSettings.addObserver("screen.brightness", observer2);
|
||||||
navigator.mozSettings.addObserver("screen.brightness", observerOnlyCalledOnce);
|
navigator.mozSettings.addObserver("screen.brightness", observerOnlyCalledOnce);
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req2 = lock.get("screen.brightness");
|
req2 = lock.get("screen.brightness");
|
||||||
req2.onsuccess = function() {
|
req2.onsuccess = function() {
|
||||||
ok(true, "set observeSetting done!");
|
ok(true, "set observeSetting done!");
|
||||||
|
@ -141,7 +137,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
ok(true, "test observers");
|
ok(true, "test observers");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.set(screenBright);
|
req = lock.set(screenBright);
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "set1 done");
|
ok(true, "set1 done");
|
||||||
|
@ -150,7 +146,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
ok(true, "test observers");
|
ok(true, "test observers");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.get("screen.brightness");
|
req = lock.get("screen.brightness");
|
||||||
navigator.mozSettings.removeObserver("screen.brightness", observerOnlyCalledOnce);
|
navigator.mozSettings.removeObserver("screen.brightness", observerOnlyCalledOnce);
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
|
@ -160,7 +156,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
ok(true, "removing Event Listener");
|
ok(true, "removing Event Listener");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.set(screenBright);
|
req = lock.set(screenBright);
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "set2 done");
|
ok(true, "set2 done");
|
||||||
|
@ -173,7 +169,7 @@ var steps = [
|
||||||
|
|
||||||
function() {
|
function() {
|
||||||
ok(true, "delete onsettingschange");
|
ok(true, "delete onsettingschange");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
navigator.mozSettings.onsettingchange = null;
|
navigator.mozSettings.onsettingchange = null;
|
||||||
req = lock.set(screenBright);
|
req = lock.set(screenBright);
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
|
@ -184,7 +180,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Waiting for all set callbacks");
|
ok(true, "Waiting for all set callbacks");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.get("screen.brightness");
|
req = lock.get("screen.brightness");
|
||||||
req.onsuccess = function() {
|
req.onsuccess = function() {
|
||||||
ok(true, "Done");
|
ok(true, "Done");
|
||||||
|
@ -198,7 +194,7 @@ var steps = [
|
||||||
navigator.mozSettings.addObserver("screen.brightness", observer1);
|
navigator.mozSettings.addObserver("screen.brightness", observer1);
|
||||||
navigator.mozSettings.addObserver("screen.brightness", observer2);
|
navigator.mozSettings.addObserver("screen.brightness", observer2);
|
||||||
navigator.mozSettings.addObserver("screen.brightness", observerWithNext);
|
navigator.mozSettings.addObserver("screen.brightness", observerWithNext);
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req2 = lock.get("screen.brightness");
|
req2 = lock.get("screen.brightness");
|
||||||
req2.onsuccess = function() {
|
req2.onsuccess = function() {
|
||||||
ok(true, "set observeSetting done!");
|
ok(true, "set observeSetting done!");
|
||||||
|
@ -208,7 +204,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
ok(true, "test observers");
|
ok(true, "test observers");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.set(screenBright);
|
req = lock.set(screenBright);
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "set1 done");
|
ok(true, "set1 done");
|
||||||
|
@ -217,7 +213,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
ok(true, "removing Event Listener");
|
ok(true, "removing Event Listener");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.set(screenBright);
|
req = lock.set(screenBright);
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "set2 done");
|
ok(true, "set2 done");
|
||||||
|
@ -228,7 +224,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
ok(true, "test Event Listener");
|
ok(true, "test Event Listener");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.set(screenBright);
|
req = lock.set(screenBright);
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "set3 done");
|
ok(true, "set3 done");
|
||||||
|
@ -237,7 +233,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
ok(true, "removing Event Listener");
|
ok(true, "removing Event Listener");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
navigator.mozSettings.removeObserver("screen.brightness", observerWithNext);
|
navigator.mozSettings.removeObserver("screen.brightness", observerWithNext);
|
||||||
req = lock.set(screenBright);
|
req = lock.set(screenBright);
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
|
@ -250,7 +246,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
ok(true, "removing Event Listener");
|
ok(true, "removing Event Listener");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.get("screen.brightness");
|
req = lock.get("screen.brightness");
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "get5 done");
|
ok(true, "get5 done");
|
||||||
|
@ -260,7 +256,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
ok(true, "Clear DB");
|
ok(true, "Clear DB");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.clear();
|
req = lock.clear();
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "Deleted the database");
|
ok(true, "Deleted the database");
|
||||||
|
@ -270,7 +266,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Deleting database");
|
ok(true, "Deleting database");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.clear();
|
req = lock.clear();
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "Deleted the database");
|
ok(true, "Deleted the database");
|
||||||
|
@ -279,7 +275,7 @@ var steps = [
|
||||||
req.onerror = onFailure;
|
req.onerror = onFailure;
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
navigator.mozSettings.onsettingchange = onComplexSettingschangeWithNext;
|
navigator.mozSettings.onsettingchange = onComplexSettingschangeWithNext;
|
||||||
req2 = navigator.mozSettings.createLock().set({'test.key': cset});
|
req2 = navigator.mozSettings.createLock().set({'test.key': cset});
|
||||||
req2.onsuccess = function () {
|
req2.onsuccess = function () {
|
||||||
|
|
|
@ -21,10 +21,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id={678695}
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
if (SpecialPowers.isMainProcess()) {
|
var url = SimpleTest.getTestFileURL("file_loadserver.js");
|
||||||
SpecialPowers.Cu.import("resource://gre/modules/SettingsRequestManager.jsm");
|
var script = SpecialPowers.loadChromeScript(url);
|
||||||
}
|
|
||||||
|
|
||||||
SpecialPowers.removePermission("settings-read", document);
|
SpecialPowers.removePermission("settings-read", document);
|
||||||
SpecialPowers.removePermission("settings-write", document);
|
SpecialPowers.removePermission("settings-write", document);
|
||||||
SpecialPowers.addPermission("settings-api-read", true, document);
|
SpecialPowers.addPermission("settings-api-read", true, document);
|
||||||
|
@ -80,21 +78,19 @@ function check(o1, o2) {
|
||||||
var req, req2, req3, req4, req5, req6;
|
var req, req2, req3, req4, req5, req6;
|
||||||
var index = 0;
|
var index = 0;
|
||||||
|
|
||||||
var mozSettings = navigator.mozSettings;
|
|
||||||
|
|
||||||
var steps = [
|
var steps = [
|
||||||
// Can't delete database here since that requires permissions we don't want
|
// Can't delete database here since that requires permissions we don't want
|
||||||
// to give the page.
|
// to give the page.
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Setting wallpaper");
|
ok(true, "Setting wallpaper");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.set(wallpaper);
|
req = lock.set(wallpaper);
|
||||||
req.onsuccess = function () {
|
req.onsuccess = function () {
|
||||||
ok(true, "set done");
|
ok(true, "set done");
|
||||||
}
|
}
|
||||||
req.onerror = onFailure;
|
req.onerror = onFailure;
|
||||||
|
|
||||||
var lock2 = mozSettings.createLock();
|
var lock2 = navigator.mozSettings.createLock();
|
||||||
req2 = lock2.get("wallpaper.image");
|
req2 = lock2.get("wallpaper.image");
|
||||||
req2.onsuccess = function () {
|
req2.onsuccess = function () {
|
||||||
is(Object.keys(req2.result).length, 1, "length 1");
|
is(Object.keys(req2.result).length, 1, "length 1");
|
||||||
|
@ -106,7 +102,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Get Wifi");
|
ok(true, "Get Wifi");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.get("wifi.enabled");
|
req = lock.get("wifi.enabled");
|
||||||
req.onerror = function () {
|
req.onerror = function () {
|
||||||
ok(true, "get failed (expected)");
|
ok(true, "get failed (expected)");
|
||||||
|
@ -116,7 +112,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Set Wifi");
|
ok(true, "Set Wifi");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.set(wifi);
|
req = lock.set(wifi);
|
||||||
req.onerror = function () {
|
req.onerror = function () {
|
||||||
ok(true, "set failed (expected)");
|
ok(true, "set failed (expected)");
|
||||||
|
@ -126,7 +122,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Set combination (1 valid 1 not valid)");
|
ok(true, "Set combination (1 valid 1 not valid)");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.set(combination);
|
req = lock.set(combination);
|
||||||
req.onerror = function () {
|
req.onerror = function () {
|
||||||
ok(true, "set failed (expected)");
|
ok(true, "set failed (expected)");
|
||||||
|
@ -136,7 +132,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
ok(true, "All requests on a failed lock should fail");
|
ok(true, "All requests on a failed lock should fail");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
lock.onsettingstransactionfailure = function (evt) {
|
lock.onsettingstransactionfailure = function (evt) {
|
||||||
ok(evt.error == "Lock failed a permissions check, all requests now failing.", "transaction failure on permissions error message correct.");
|
ok(evt.error == "Lock failed a permissions check, all requests now failing.", "transaction failure on permissions error message correct.");
|
||||||
ok(true, "transaction failed (expected) ");
|
ok(true, "transaction failed (expected) ");
|
||||||
|
@ -157,7 +153,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
ok(true, "Set combination (1 valid 1 not valid)");
|
ok(true, "Set combination (1 valid 1 not valid)");
|
||||||
var lock = mozSettings.createLock();
|
var lock = navigator.mozSettings.createLock();
|
||||||
req = lock.set(combination);
|
req = lock.set(combination);
|
||||||
req.onerror = function () {
|
req.onerror = function () {
|
||||||
ok(true, "set failed (expected)");
|
ok(true, "set failed (expected)");
|
||||||
|
|
|
@ -73,6 +73,10 @@ RILSystemMessengerHelper.prototype = {
|
||||||
aDuration, aOutgoing, aHangUpLocal);
|
aDuration, aOutgoing, aHangUpLocal);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
notifyUssdReceived: function(aServiceId, aMessage, aSessionEnded) {
|
||||||
|
this.messenger.notifyUssdReceived(aServiceId, aMessage, aSessionEnded);
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nsISmsMessenger API
|
* nsISmsMessenger API
|
||||||
*/
|
*/
|
||||||
|
@ -100,10 +104,6 @@ RILSystemMessengerHelper.prototype = {
|
||||||
/**
|
/**
|
||||||
* nsIMobileConnectionMessenger API
|
* nsIMobileConnectionMessenger API
|
||||||
*/
|
*/
|
||||||
notifyUssdReceived: function(aServiceId, aMessage, aSessionEnded) {
|
|
||||||
this.messenger.notifyUssdReceived(aServiceId, aMessage, aSessionEnded);
|
|
||||||
},
|
|
||||||
|
|
||||||
notifyCdmaInfoRecDisplay: function(aServiceId, aDisplay) {
|
notifyCdmaInfoRecDisplay: function(aServiceId, aDisplay) {
|
||||||
this.messenger.notifyCdmaInfoRecDisplay(aServiceId, aDisplay);
|
this.messenger.notifyCdmaInfoRecDisplay(aServiceId, aDisplay);
|
||||||
},
|
},
|
||||||
|
|
|
@ -1993,20 +1993,20 @@ RadioInterface.prototype = {
|
||||||
matchMvno: function(target, message) {
|
matchMvno: function(target, message) {
|
||||||
if (DEBUG) this.debug("matchMvno: " + JSON.stringify(message));
|
if (DEBUG) this.debug("matchMvno: " + JSON.stringify(message));
|
||||||
|
|
||||||
if (!message || !message.mvnoType || !message.mvnoData) {
|
if (!message || !message.mvnoData) {
|
||||||
message.errorMsg = RIL.GECKO_ERROR_INVALID_PARAMETER;
|
message.errorMsg = RIL.GECKO_ERROR_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!message.errorMsg) {
|
if (!message.errorMsg) {
|
||||||
switch (message.mvnoType) {
|
switch (message.mvnoType) {
|
||||||
case "imsi":
|
case RIL.GECKO_CARDMVNO_TYPE_IMSI:
|
||||||
if (!this.rilContext.imsi) {
|
if (!this.rilContext.imsi) {
|
||||||
message.errorMsg = RIL.GECKO_ERROR_GENERIC_FAILURE;
|
message.errorMsg = RIL.GECKO_ERROR_GENERIC_FAILURE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
message.result = this.isImsiMatches(message.mvnoData);
|
message.result = this.isImsiMatches(message.mvnoData);
|
||||||
break;
|
break;
|
||||||
case "spn":
|
case RIL.GECKO_CARDMVNO_TYPE_SPN:
|
||||||
let spn = this.rilContext.iccInfo && this.rilContext.iccInfo.spn;
|
let spn = this.rilContext.iccInfo && this.rilContext.iccInfo.spn;
|
||||||
if (!spn) {
|
if (!spn) {
|
||||||
message.errorMsg = RIL.GECKO_ERROR_GENERIC_FAILURE;
|
message.errorMsg = RIL.GECKO_ERROR_GENERIC_FAILURE;
|
||||||
|
@ -2014,7 +2014,7 @@ RadioInterface.prototype = {
|
||||||
}
|
}
|
||||||
message.result = spn == message.mvnoData;
|
message.result = spn == message.mvnoData;
|
||||||
break;
|
break;
|
||||||
case "gid":
|
case RIL.GECKO_CARDMVNO_TYPE_GID:
|
||||||
this.workerMessenger.send("getGID1", null, (function(response) {
|
this.workerMessenger.send("getGID1", null, (function(response) {
|
||||||
let gid = response.gid1;
|
let gid = response.gid1;
|
||||||
let mvnoDataLength = message.mvnoData.length;
|
let mvnoDataLength = message.mvnoData.length;
|
||||||
|
|
|
@ -2645,6 +2645,11 @@ this.GECKO_CARDCONTACT_TYPE_ADN = 0;
|
||||||
this.GECKO_CARDCONTACT_TYPE_FDN = 1;
|
this.GECKO_CARDCONTACT_TYPE_FDN = 1;
|
||||||
this.GECKO_CARDCONTACT_TYPE_SDN = 2;
|
this.GECKO_CARDCONTACT_TYPE_SDN = 2;
|
||||||
|
|
||||||
|
// See nsIIccProvider::CARD_MVNO_TYPE_*
|
||||||
|
this.GECKO_CARDMVNO_TYPE_IMSI = 0;
|
||||||
|
this.GECKO_CARDMVNO_TYPE_SPN = 1;
|
||||||
|
this.GECKO_CARDMVNO_TYPE_GID = 2;
|
||||||
|
|
||||||
// See ril.h RIL_PersoSubstate
|
// See ril.h RIL_PersoSubstate
|
||||||
this.PERSONSUBSTATE = {};
|
this.PERSONSUBSTATE = {};
|
||||||
PERSONSUBSTATE[CARD_PERSOSUBSTATE_UNKNOWN] = GECKO_CARDSTATE_UNKNOWN;
|
PERSONSUBSTATE[CARD_PERSOSUBSTATE_UNKNOWN] = GECKO_CARDSTATE_UNKNOWN;
|
||||||
|
@ -2999,6 +3004,10 @@ this.MMI_SC_CLIR = "31";
|
||||||
// MMI call waiting service code
|
// MMI call waiting service code
|
||||||
this.MMI_SC_CALL_WAITING = "43";
|
this.MMI_SC_CALL_WAITING = "43";
|
||||||
|
|
||||||
|
// MMI service code for registration new password as defined in TS 22.030 6.5.4
|
||||||
|
this.MMI_SC_CHANGE_PASSWORD = "03";
|
||||||
|
this.MMI_ZZ_BARRING_SERVICE = "330";
|
||||||
|
|
||||||
// MMI call barring service codes
|
// MMI call barring service codes
|
||||||
this.MMI_SC_BAOC = "33";
|
this.MMI_SC_BAOC = "33";
|
||||||
this.MMI_SC_BAOIC = "331";
|
this.MMI_SC_BAOIC = "331";
|
||||||
|
@ -3031,6 +3040,7 @@ this.MMI_KS_SC_PIN = "scPin";
|
||||||
this.MMI_KS_SC_PIN2 = "scPin2";
|
this.MMI_KS_SC_PIN2 = "scPin2";
|
||||||
this.MMI_KS_SC_PUK = "scPuk";
|
this.MMI_KS_SC_PUK = "scPuk";
|
||||||
this.MMI_KS_SC_PUK2 = "scPuk2";
|
this.MMI_KS_SC_PUK2 = "scPuk2";
|
||||||
|
this.MMI_KS_SC_CHANGE_PASSWORD = "scChangePassword"
|
||||||
this.MMI_KS_SC_IMEI = "scImei";
|
this.MMI_KS_SC_IMEI = "scImei";
|
||||||
this.MMI_KS_SC_USSD = "scUssd";
|
this.MMI_KS_SC_USSD = "scUssd";
|
||||||
this.MMI_KS_SC_CALL = "scCall";
|
this.MMI_KS_SC_CALL = "scCall";
|
||||||
|
@ -3040,13 +3050,16 @@ this.MMI_ERROR_KS_ERROR = "emMmiError";
|
||||||
this.MMI_ERROR_KS_NOT_SUPPORTED = "emMmiErrorNotSupported";
|
this.MMI_ERROR_KS_NOT_SUPPORTED = "emMmiErrorNotSupported";
|
||||||
this.MMI_ERROR_KS_INVALID_ACTION = "emMmiErrorInvalidAction";
|
this.MMI_ERROR_KS_INVALID_ACTION = "emMmiErrorInvalidAction";
|
||||||
this.MMI_ERROR_KS_MISMATCH_PIN = "emMmiErrorMismatchPin";
|
this.MMI_ERROR_KS_MISMATCH_PIN = "emMmiErrorMismatchPin";
|
||||||
|
this.MMI_ERROR_KS_MISMATCH_PASSWORD = "emMmiErrorMismatchPassword";
|
||||||
this.MMI_ERROR_KS_BAD_PIN = "emMmiErrorBadPin";
|
this.MMI_ERROR_KS_BAD_PIN = "emMmiErrorBadPin";
|
||||||
this.MMI_ERROR_KS_BAD_PUK = "emMmiErrorBadPuk";
|
this.MMI_ERROR_KS_BAD_PUK = "emMmiErrorBadPuk";
|
||||||
this.MMI_ERROR_KS_INVALID_PIN = "emMmiErrorInvalidPin";
|
this.MMI_ERROR_KS_INVALID_PIN = "emMmiErrorInvalidPin";
|
||||||
|
this.MMI_ERROR_KS_INVALID_PASSWORD = "emMmiErrorInvalidPassword";
|
||||||
this.MMI_ERROR_KS_NEEDS_PUK = "emMmiErrorNeedsPuk";
|
this.MMI_ERROR_KS_NEEDS_PUK = "emMmiErrorNeedsPuk";
|
||||||
this.MMI_ERROR_KS_SIM_BLOCKED = "emMmiErrorSimBlocked";
|
this.MMI_ERROR_KS_SIM_BLOCKED = "emMmiErrorSimBlocked";
|
||||||
|
|
||||||
// MMI status message.
|
// MMI status message.
|
||||||
|
this.MMI_SM_KS_PASSWORD_CHANGED = "smPasswordChanged";
|
||||||
this.MMI_SM_KS_PIN_CHANGED = "smPinChanged";
|
this.MMI_SM_KS_PIN_CHANGED = "smPinChanged";
|
||||||
this.MMI_SM_KS_PIN2_CHANGED = "smPin2Changed";
|
this.MMI_SM_KS_PIN2_CHANGED = "smPin2Changed";
|
||||||
this.MMI_SM_KS_PIN_UNBLOCKED = "smPinUnblocked";
|
this.MMI_SM_KS_PIN_UNBLOCKED = "smPinUnblocked";
|
||||||
|
|
|
@ -2409,6 +2409,33 @@ RilObject.prototype = {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _isValidChangePasswordRequest() {
|
||||||
|
if (mmi.procedure !== MMI_PROCEDURE_REGISTRATION &&
|
||||||
|
mmi.procedure !== MMI_PROCEDURE_ACTIVATION) {
|
||||||
|
_sendMMIError(MMI_ERROR_KS_INVALID_ACTION);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mmi.sia !== "" && mmi.sia !== MMI_ZZ_BARRING_SERVICE) {
|
||||||
|
_sendMMIError(MMI_ERROR_KS_NOT_SUPPORTED);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let validPassword = si => /^[0-9]{4}$/.test(si);
|
||||||
|
if (!validPassword(mmi.sib) || !validPassword(mmi.sic) ||
|
||||||
|
!validPassword(mmi.pwd)) {
|
||||||
|
_sendMMIError(MMI_ERROR_KS_INVALID_PASSWORD);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mmi.sic != mmi.pwd) {
|
||||||
|
_sendMMIError(MMI_ERROR_KS_MISMATCH_PASSWORD);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
let _isRadioAvailable = (function() {
|
let _isRadioAvailable = (function() {
|
||||||
if (this.radioState !== GECKO_RADIOSTATE_ENABLED) {
|
if (this.radioState !== GECKO_RADIOSTATE_ENABLED) {
|
||||||
_sendMMIError(GECKO_ERROR_RADIO_NOT_AVAILABLE);
|
_sendMMIError(GECKO_ERROR_RADIO_NOT_AVAILABLE);
|
||||||
|
@ -2556,6 +2583,17 @@ RilObject.prototype = {
|
||||||
this.setCLIR(options);
|
this.setCLIR(options);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Change call barring password
|
||||||
|
case MMI_SC_CHANGE_PASSWORD:
|
||||||
|
if (!_isRadioAvailable() || !_isValidChangePasswordRequest()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
options.pin = mmi.sib;
|
||||||
|
options.newPin = mmi.sic;
|
||||||
|
this.changeCallBarringPassword(options);
|
||||||
|
return;
|
||||||
|
|
||||||
// Call barring
|
// Call barring
|
||||||
case MMI_SC_BAOC:
|
case MMI_SC_BAOC:
|
||||||
case MMI_SC_BAOIC:
|
case MMI_SC_BAOIC:
|
||||||
|
@ -2617,7 +2655,7 @@ RilObject.prototype = {
|
||||||
|
|
||||||
options.ussd = mmi.fullMMI;
|
options.ussd = mmi.fullMMI;
|
||||||
|
|
||||||
if (options.startNewSession && this._ussdSession) {
|
if (this._ussdSession) {
|
||||||
if (DEBUG) this.context.debug("Cancel existing ussd session.");
|
if (DEBUG) this.context.debug("Cancel existing ussd session.");
|
||||||
this.cachedUSSDRequest = options;
|
this.cachedUSSDRequest = options;
|
||||||
this.cancelUSSD({});
|
this.cancelUSSD({});
|
||||||
|
@ -5986,6 +6024,13 @@ RilObject.prototype[REQUEST_CHANGE_BARRING_PASSWORD] =
|
||||||
if (options.rilRequestError) {
|
if (options.rilRequestError) {
|
||||||
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
|
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options.rilMessageType != "sendMMI") {
|
||||||
|
this.sendChromeMessage(options);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
options.statusMessage = MMI_SM_KS_PASSWORD_CHANGED;
|
||||||
this.sendChromeMessage(options);
|
this.sendChromeMessage(options);
|
||||||
};
|
};
|
||||||
RilObject.prototype[REQUEST_SIM_OPEN_CHANNEL] = function REQUEST_SIM_OPEN_CHANNEL(length, options) {
|
RilObject.prototype[REQUEST_SIM_OPEN_CHANNEL] = function REQUEST_SIM_OPEN_CHANNEL(length, options) {
|
||||||
|
|
|
@ -566,7 +566,7 @@ TelephonyService.prototype = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._dialMMI(aClientId, mmi, aCallback, true);
|
this._dialMMI(aClientId, mmi, aCallback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -664,15 +664,14 @@ TelephonyService.prototype = {
|
||||||
* @param aStartNewSession
|
* @param aStartNewSession
|
||||||
* True to start a new session for ussd request.
|
* True to start a new session for ussd request.
|
||||||
*/
|
*/
|
||||||
_dialMMI: function(aClientId, aMmi, aCallback, aStartNewSession) {
|
_dialMMI: function(aClientId, aMmi, aCallback) {
|
||||||
let mmiServiceCode = aMmi ?
|
let mmiServiceCode = aMmi ?
|
||||||
this._serviceCodeToKeyString(aMmi.serviceCode) : RIL.MMI_KS_SC_USSD;
|
this._serviceCodeToKeyString(aMmi.serviceCode) : RIL.MMI_KS_SC_USSD;
|
||||||
|
|
||||||
aCallback.notifyDialMMI(mmiServiceCode);
|
aCallback.notifyDialMMI(mmiServiceCode);
|
||||||
|
|
||||||
this._sendToRilWorker(aClientId, "sendMMI",
|
this._sendToRilWorker(aClientId, "sendMMI",
|
||||||
{ mmi: aMmi,
|
{ mmi: aMmi }, response => {
|
||||||
startNewSession: aStartNewSession }, response => {
|
|
||||||
if (DEBUG) debug("MMI response: " + JSON.stringify(response));
|
if (DEBUG) debug("MMI response: " + JSON.stringify(response));
|
||||||
|
|
||||||
if (!response.success) {
|
if (!response.success) {
|
||||||
|
@ -907,6 +906,8 @@ TelephonyService.prototype = {
|
||||||
return RIL.MMI_KS_SC_CALL_BARRING;
|
return RIL.MMI_KS_SC_CALL_BARRING;
|
||||||
case RIL.MMI_SC_CALL_WAITING:
|
case RIL.MMI_SC_CALL_WAITING:
|
||||||
return RIL.MMI_KS_SC_CALL_WAITING;
|
return RIL.MMI_KS_SC_CALL_WAITING;
|
||||||
|
case RIL.MMI_SC_CHANGE_PASSWORD:
|
||||||
|
return RIL.MMI_KS_SC_CHANGE_PASSWORD;
|
||||||
default:
|
default:
|
||||||
return RIL.MMI_KS_SC_USSD;
|
return RIL.MMI_KS_SC_USSD;
|
||||||
}
|
}
|
||||||
|
@ -1302,13 +1303,7 @@ TelephonyService.prototype = {
|
||||||
aMessage + " (sessionEnded : " + aSessionEnded + ")");
|
aMessage + " (sessionEnded : " + aSessionEnded + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
gGonkMobileConnectionService.notifyUssdReceived(aClientId, aMessage,
|
gTelephonyMessenger.notifyUssdReceived(aClientId, aMessage, aSessionEnded);
|
||||||
aSessionEnded);
|
|
||||||
},
|
|
||||||
|
|
||||||
dialMMI: function(aClientId, aMmiString, aCallback) {
|
|
||||||
let mmi = this._parseMMI(aMmiString, this._hasCalls(aClientId));
|
|
||||||
this._dialMMI(aClientId, mmi, aCallback, false);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1355,7 +1350,6 @@ USSDReceivedWrapper.prototype = {
|
||||||
let event = new aWindow.USSDReceivedEvent("ussdreceived", {
|
let event = new aWindow.USSDReceivedEvent("ussdreceived", {
|
||||||
serviceId: aMessage.serviceId,
|
serviceId: aMessage.serviceId,
|
||||||
message: aMessage.message,
|
message: aMessage.message,
|
||||||
sessionEnded: aMessage.sessionEnded,
|
|
||||||
session: session
|
session: session
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
"@mozilla.org/telephony/gonktelephonyservice;1"
|
"@mozilla.org/telephony/gonktelephonyservice;1"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
[scriptable, uuid(068d7bf2-1773-48ef-95f8-bd835115fed7)]
|
[scriptable, uuid(cbbe66d8-865b-11e4-94f1-ab441e55905b)]
|
||||||
interface nsIGonkTelephonyService : nsITelephonyService
|
interface nsIGonkTelephonyService : nsITelephonyService
|
||||||
{
|
{
|
||||||
void notifyAudioStateChanged(in unsigned long clientId, in short state);
|
void notifyAudioStateChanged(in unsigned long clientId, in short state);
|
||||||
|
@ -31,7 +31,4 @@ interface nsIGonkTelephonyService : nsITelephonyService
|
||||||
|
|
||||||
void notifyUssdReceived(in unsigned long clientId, in DOMString message,
|
void notifyUssdReceived(in unsigned long clientId, in DOMString message,
|
||||||
in boolean sessionEnded);
|
in boolean sessionEnded);
|
||||||
|
|
||||||
void dialMMI(in unsigned long clientId, in AString mmiString,
|
|
||||||
in nsITelephonyDialCallback callback);
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#include "nsISupports.idl"
|
#include "nsISupports.idl"
|
||||||
|
|
||||||
[scriptable, uuid(998a48b2-5b54-11e4-833e-6b17c1427d49)]
|
[scriptable, uuid(84045b7e-84fb-11e4-a94c-5ba58d0d5932)]
|
||||||
interface nsITelephonyMessenger : nsISupports
|
interface nsITelephonyMessenger : nsISupports
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -37,4 +37,18 @@ interface nsITelephonyMessenger : nsISupports
|
||||||
in unsigned long aDuration,
|
in unsigned long aDuration,
|
||||||
in boolean aOutgoing,
|
in boolean aOutgoing,
|
||||||
in boolean aHangUpLocal);
|
in boolean aHangUpLocal);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 'ussd-received' system message
|
||||||
|
*
|
||||||
|
* @param aServiceId
|
||||||
|
* The ID of Service where this info is notified from.
|
||||||
|
* @param aMessage
|
||||||
|
* USSD Message to be displayed.
|
||||||
|
* @param aSessionEnded
|
||||||
|
* True if USSD session is ended.
|
||||||
|
*/
|
||||||
|
void notifyUssdReceived(in unsigned long aServiceId,
|
||||||
|
in DOMString aMessage,
|
||||||
|
in boolean aSessionEnded);
|
||||||
};
|
};
|
|
@ -33,6 +33,7 @@ qemu = true
|
||||||
[test_incoming_onstatechange.js]
|
[test_incoming_onstatechange.js]
|
||||||
[test_mmi.js]
|
[test_mmi.js]
|
||||||
[test_mmi_call_forwarding.js]
|
[test_mmi_call_forwarding.js]
|
||||||
|
[test_mmi_change_barring_password.js]
|
||||||
[test_mmi_change_pin.js]
|
[test_mmi_change_pin.js]
|
||||||
[test_mmi_unlock_puk.js]
|
[test_mmi_unlock_puk.js]
|
||||||
[test_multiple_hold.js]
|
[test_multiple_hold.js]
|
||||||
|
|
|
@ -0,0 +1,99 @@
|
||||||
|
/* 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 = [
|
||||||
|
// Test passing no password.
|
||||||
|
{
|
||||||
|
password: "",
|
||||||
|
newPassword: "0000",
|
||||||
|
newPasswordAgain: "1111",
|
||||||
|
expectedError: {
|
||||||
|
name: "emMmiErrorInvalidPassword"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// Test passing no newPassword.
|
||||||
|
{
|
||||||
|
password: "0000",
|
||||||
|
newPassword: "",
|
||||||
|
newPasswordAgain: "",
|
||||||
|
expectedError: {
|
||||||
|
name: "emMmiErrorInvalidPassword"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// Test passing mismatched newPassword.
|
||||||
|
{
|
||||||
|
password: "0000",
|
||||||
|
newPassword: "0000",
|
||||||
|
newPasswordAgain: "1111",
|
||||||
|
expectedError: {
|
||||||
|
name: "emMmiErrorMismatchPassword"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// Test passing invalid password (not 4 digits).
|
||||||
|
{
|
||||||
|
password: "000",
|
||||||
|
newPassword: "0000",
|
||||||
|
newPasswordAgain: "0000",
|
||||||
|
expectedError: {
|
||||||
|
name: "emMmiErrorInvalidPassword"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// TODO: Bug 906603 - B2G RIL: Support Change Call Barring Password on Emulator.
|
||||||
|
// Currently emulator doesn't support REQUEST_CHANGE_BARRING_PASSWORD, so we
|
||||||
|
// expect to get a 'RequestNotSupported' error here.
|
||||||
|
{
|
||||||
|
password: "0000",
|
||||||
|
newPassword: "1234",
|
||||||
|
newPasswordAgain: "1234",
|
||||||
|
expectedError: {
|
||||||
|
name: "RequestNotSupported"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
let MMI_PREFIX = [
|
||||||
|
"*03*330*",
|
||||||
|
"**03*330*",
|
||||||
|
"*03**",
|
||||||
|
"**03**",
|
||||||
|
];
|
||||||
|
|
||||||
|
function testChangeCallBarringPassword(aMMIPrefix, aPassword, aNewPassword,
|
||||||
|
aNewPasswordAgain, aExpectedError) {
|
||||||
|
let MMI_CODE = aMMIPrefix + aPassword + "*" + aNewPassword + "*" + aNewPasswordAgain + "#";
|
||||||
|
log("Test " + MMI_CODE);
|
||||||
|
|
||||||
|
return gSendMMI(MMI_CODE).then(aResult => {
|
||||||
|
is(aResult.success, !aExpectedError, "check success");
|
||||||
|
is(aResult.serviceCode, "scChangePassword", "Check service code");
|
||||||
|
|
||||||
|
if (aResult.success) {
|
||||||
|
is(aResult.statusMessage, "smPasswordChanged", "Check status message");
|
||||||
|
} else {
|
||||||
|
is(aResult.statusMessage, aExpectedError.name, "Check name");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start test
|
||||||
|
startTest(function() {
|
||||||
|
let promise = Promise.resolve();
|
||||||
|
|
||||||
|
for (let prefix of MMI_PREFIX) {
|
||||||
|
for (let i = 0; i < TEST_DATA.length; i++) {
|
||||||
|
let data = TEST_DATA[i];
|
||||||
|
promise = promise.then(() => testChangeCallBarringPassword(prefix,
|
||||||
|
data.password,
|
||||||
|
data.newPassword,
|
||||||
|
data.newPasswordAgain,
|
||||||
|
data.expectedError));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return promise
|
||||||
|
.catch(error => ok(false, "Promise reject: " + error))
|
||||||
|
.then(finish);
|
||||||
|
});
|
|
@ -40,11 +40,11 @@ partial interface HTMLMenuElement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a native menu builder. The builder type is dependent on menu type.
|
* Creates a native menu builder. The builder type is dependent on menu type.
|
||||||
* Currently, it returns nsXULContextMenuBuilder for context menus.
|
* Currently, it returns the @mozilla.org/content/html-menu-builder;1
|
||||||
* Toolbar menus are not yet supported (the method returns null).
|
* component. Toolbar menus are not yet supported (the method returns null).
|
||||||
*/
|
*/
|
||||||
[ChromeOnly]
|
[ChromeOnly]
|
||||||
MenuBuilder createBuilder();
|
MenuBuilder? createBuilder();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Builds a menu by iterating over menu children.
|
* Builds a menu by iterating over menu children.
|
||||||
|
|
|
@ -82,6 +82,13 @@ enum IccContactType
|
||||||
"sdn" // Service Dialling Number.
|
"sdn" // Service Dialling Number.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum IccMvnoType
|
||||||
|
{
|
||||||
|
"imsi",
|
||||||
|
"spn",
|
||||||
|
"gid"
|
||||||
|
};
|
||||||
|
|
||||||
dictionary IccUnlockCardLockOptions
|
dictionary IccUnlockCardLockOptions
|
||||||
{
|
{
|
||||||
required IccLockType lockType;
|
required IccLockType lockType;
|
||||||
|
@ -315,17 +322,13 @@ interface MozIcc : EventTarget
|
||||||
*
|
*
|
||||||
* @param mvnoType
|
* @param mvnoType
|
||||||
* Mvno type to use to compare the match data.
|
* Mvno type to use to compare the match data.
|
||||||
* Currently, we only support 'imsi'.
|
|
||||||
* @param matchData
|
* @param matchData
|
||||||
* Data to be compared with ICC's field.
|
* Data to be compared with ICC's field.
|
||||||
*
|
*
|
||||||
* @return a DOMRequest.
|
* @return a DOMRequest.
|
||||||
* The request's result will be a boolean indicating the matching
|
* The request's result will be a boolean indicating the matching
|
||||||
* result.
|
* result.
|
||||||
*
|
|
||||||
* TODO: change param mvnoType to WebIDL enum after Bug 864489 -
|
|
||||||
* B2G RIL: use ipdl as IPC in MozIccManager
|
|
||||||
*/
|
*/
|
||||||
[Throws]
|
[Throws]
|
||||||
DOMRequest matchMvno(DOMString mvnoType, DOMString matchData);
|
DOMRequest matchMvno(IccMvnoType mvnoType, DOMString matchData);
|
||||||
};
|
};
|
||||||
|
|
|
@ -263,49 +263,6 @@ interface MozMobileConnection : EventTarget
|
||||||
[Throws, CheckPermissions="mobileconnection"]
|
[Throws, CheckPermissions="mobileconnection"]
|
||||||
DOMRequest getVoicePrivacyMode();
|
DOMRequest getVoicePrivacyMode();
|
||||||
|
|
||||||
/**
|
|
||||||
* Send a MMI message.
|
|
||||||
*
|
|
||||||
* @param mmi
|
|
||||||
* DOMString containing an MMI string that can be associated to a
|
|
||||||
* USSD request or other RIL functionality.
|
|
||||||
*
|
|
||||||
* @return a DOMRequest.
|
|
||||||
*
|
|
||||||
* If successful, the request's onsuccess will be called. And the request's
|
|
||||||
* result will be an object containing information about the operation.
|
|
||||||
* @see MozMMIResult for the detail of result.
|
|
||||||
*
|
|
||||||
* Otherwise, the request's onerror will be called, and the request's error
|
|
||||||
* will be a DOMMMIError.
|
|
||||||
* @see DOMMMIError for the detail of error.
|
|
||||||
*
|
|
||||||
* Note: In case that the MMI code requires sending an USSD request, the
|
|
||||||
* DOMrequest 'success' event means that the RIL has successfully processed
|
|
||||||
* and sent the USSD request to the network. The network reply will be
|
|
||||||
* reported via 'onussdreceived' event. If the MMI code is not associated to
|
|
||||||
* a USSD but to other RIL request its result, if one is needed, will be
|
|
||||||
* notified via the returned DOMRequest 'success' or 'error' event.
|
|
||||||
*/
|
|
||||||
[Throws, CheckPermissions="mobileconnection"]
|
|
||||||
DOMRequest sendMMI(DOMString mmi);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cancel the current MMI request if one exists.
|
|
||||||
*
|
|
||||||
* @return a DOMRequest.
|
|
||||||
*
|
|
||||||
* If successful, the request's onsuccess will be called. And the request's
|
|
||||||
* result will be an object containing information about the operation.
|
|
||||||
* @see MozMMIResult for the detail of result.
|
|
||||||
*
|
|
||||||
* Otherwise, the request's onerror will be called, and the request's error
|
|
||||||
* will be a DOMMMIError.
|
|
||||||
* @see DOMMMIError for the detail of error.
|
|
||||||
*/
|
|
||||||
[Throws, CheckPermissions="mobileconnection"]
|
|
||||||
DOMRequest cancelMMI();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures call forward options.
|
* Configures call forward options.
|
||||||
*
|
*
|
||||||
|
@ -522,12 +479,6 @@ interface MozMobileConnection : EventTarget
|
||||||
*/
|
*/
|
||||||
attribute EventHandler ondatachange;
|
attribute EventHandler ondatachange;
|
||||||
|
|
||||||
/**
|
|
||||||
* The 'ussdreceived' event is notified whenever a new USSD message is
|
|
||||||
* received.
|
|
||||||
*/
|
|
||||||
attribute EventHandler onussdreceived;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The 'dataerror' event is notified whenever the data connection object
|
* The 'dataerror' event is notified whenever the data connection object
|
||||||
* receives an error from the RIL.
|
* receives an error from the RIL.
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
[Pref="dom.telephony.enabled",
|
[Pref="dom.telephony.enabled",
|
||||||
CheckPermissions="telephony mobileconnection",
|
CheckPermissions="telephony",
|
||||||
AvailableIn="CertifiedApps",
|
AvailableIn="CertifiedApps",
|
||||||
Constructor(DOMString type, optional USSDReceivedEventInit eventInitDict)]
|
Constructor(DOMString type, optional USSDReceivedEventInit eventInitDict)]
|
||||||
interface USSDReceivedEvent : Event
|
interface USSDReceivedEvent : Event
|
||||||
|
@ -13,7 +13,6 @@ interface USSDReceivedEvent : Event
|
||||||
readonly attribute unsigned long serviceId;
|
readonly attribute unsigned long serviceId;
|
||||||
readonly attribute DOMString? message;
|
readonly attribute DOMString? message;
|
||||||
readonly attribute USSDSession? session; // null if session is ended.
|
readonly attribute USSDSession? session; // null if session is ended.
|
||||||
readonly attribute boolean sessionEnded; // deprecated. Bug 1070831
|
|
||||||
};
|
};
|
||||||
|
|
||||||
dictionary USSDReceivedEventInit : EventInit
|
dictionary USSDReceivedEventInit : EventInit
|
||||||
|
@ -21,5 +20,4 @@ dictionary USSDReceivedEventInit : EventInit
|
||||||
unsigned long serviceId = 0;
|
unsigned long serviceId = 0;
|
||||||
DOMString? message = null;
|
DOMString? message = null;
|
||||||
USSDSession? session = null;
|
USSDSession? session = null;
|
||||||
boolean sessionEnded = false;
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,7 +12,6 @@ if CONFIG['MOZ_XUL']:
|
||||||
DIRS += ['templates']
|
DIRS += ['templates']
|
||||||
|
|
||||||
XPIDL_SOURCES += [
|
XPIDL_SOURCES += [
|
||||||
'nsIXULContextMenuBuilder.idl',
|
|
||||||
'nsIXULOverlayProvider.idl',
|
'nsIXULOverlayProvider.idl',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -23,7 +22,6 @@ if CONFIG['MOZ_XUL']:
|
||||||
UNIFIED_SOURCES += [
|
UNIFIED_SOURCES += [
|
||||||
'nsXULCommandDispatcher.cpp',
|
'nsXULCommandDispatcher.cpp',
|
||||||
'nsXULContentSink.cpp',
|
'nsXULContentSink.cpp',
|
||||||
'nsXULContextMenuBuilder.cpp',
|
|
||||||
'nsXULElement.cpp',
|
'nsXULElement.cpp',
|
||||||
'nsXULPopupListener.cpp',
|
'nsXULPopupListener.cpp',
|
||||||
'nsXULPrototypeCache.cpp',
|
'nsXULPrototypeCache.cpp',
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
#include "nsISupports.idl"
|
|
||||||
|
|
||||||
interface nsIDOMDocumentFragment;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An interface for initialization of XUL context menu builder
|
|
||||||
* and for triggering of menuitem actions with assigned identifiers.
|
|
||||||
*/
|
|
||||||
|
|
||||||
[scriptable, uuid(eb6b42c0-2f1c-4760-b5ca-bdc9b3ec77d4)]
|
|
||||||
interface nsIXULContextMenuBuilder : nsISupports
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize builder before building.
|
|
||||||
*
|
|
||||||
* @param aDocumentFragment the fragment that will be used to append top
|
|
||||||
* level elements
|
|
||||||
*
|
|
||||||
* @param aGeneratedItemIdAttrName the name of the attribute that will be
|
|
||||||
* used to mark elements as generated and for menuitem identification
|
|
||||||
*/
|
|
||||||
void init(in nsIDOMDocumentFragment aDocumentFragment,
|
|
||||||
in AString aGeneratedItemIdAttrName);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoke the action of the menuitem with assigned id aGeneratedItemId.
|
|
||||||
*
|
|
||||||
* @param aGeneratedItemId the menuitem id
|
|
||||||
*/
|
|
||||||
void click(in DOMString aGeneratedItemId);
|
|
||||||
|
|
||||||
};
|
|
|
@ -1,230 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
#include "nsContentCreatorFunctions.h"
|
|
||||||
#include "nsIContent.h"
|
|
||||||
#include "nsIDOMDocumentFragment.h"
|
|
||||||
#include "nsIDOMHTMLElement.h"
|
|
||||||
#include "nsIDOMHTMLMenuItemElement.h"
|
|
||||||
#include "nsXULContextMenuBuilder.h"
|
|
||||||
#include "nsIDocument.h"
|
|
||||||
#include "mozilla/dom/Element.h"
|
|
||||||
|
|
||||||
using namespace mozilla;
|
|
||||||
using namespace mozilla::dom;
|
|
||||||
|
|
||||||
nsXULContextMenuBuilder::nsXULContextMenuBuilder()
|
|
||||||
: mCurrentGeneratedItemId(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
nsXULContextMenuBuilder::~nsXULContextMenuBuilder()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION(nsXULContextMenuBuilder, mFragment, mDocument,
|
|
||||||
mCurrentNode, mElements)
|
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsXULContextMenuBuilder)
|
|
||||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsXULContextMenuBuilder)
|
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXULContextMenuBuilder)
|
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIMenuBuilder)
|
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIXULContextMenuBuilder)
|
|
||||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIMenuBuilder)
|
|
||||||
NS_INTERFACE_MAP_END
|
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsXULContextMenuBuilder::OpenContainer(const nsAString& aLabel)
|
|
||||||
{
|
|
||||||
if (!mFragment) {
|
|
||||||
return NS_ERROR_NOT_INITIALIZED;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!mCurrentNode) {
|
|
||||||
mCurrentNode = mFragment;
|
|
||||||
} else {
|
|
||||||
nsCOMPtr<Element> menu;
|
|
||||||
nsresult rv = CreateElement(nsGkAtoms::menu, nullptr, getter_AddRefs(menu));
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
menu->SetAttr(kNameSpaceID_None, nsGkAtoms::label, aLabel, false);
|
|
||||||
|
|
||||||
nsCOMPtr<Element> menuPopup;
|
|
||||||
rv = CreateElement(nsGkAtoms::menupopup, nullptr,
|
|
||||||
getter_AddRefs(menuPopup));
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
rv = menu->AppendChildTo(menuPopup, false);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
rv = mCurrentNode->AppendChildTo(menu, false);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
mCurrentNode = menuPopup;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsXULContextMenuBuilder::AddItemFor(nsIDOMHTMLMenuItemElement* aElement,
|
|
||||||
bool aCanLoadIcon)
|
|
||||||
{
|
|
||||||
if (!mFragment) {
|
|
||||||
return NS_ERROR_NOT_INITIALIZED;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<Element> menuitem;
|
|
||||||
nsCOMPtr<nsIDOMHTMLElement> element = do_QueryInterface(aElement);
|
|
||||||
nsresult rv = CreateElement(nsGkAtoms::menuitem, element,
|
|
||||||
getter_AddRefs(menuitem));
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
nsAutoString type;
|
|
||||||
aElement->GetType(type);
|
|
||||||
if (type.EqualsLiteral("checkbox") || type.EqualsLiteral("radio")) {
|
|
||||||
// The menu is only temporary, so we don't need to handle
|
|
||||||
// the radio type precisely.
|
|
||||||
menuitem->SetAttr(kNameSpaceID_None, nsGkAtoms::type,
|
|
||||||
NS_LITERAL_STRING("checkbox"), false);
|
|
||||||
bool checked;
|
|
||||||
aElement->GetChecked(&checked);
|
|
||||||
if (checked) {
|
|
||||||
menuitem->SetAttr(kNameSpaceID_None, nsGkAtoms::checked,
|
|
||||||
NS_LITERAL_STRING("true"), false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nsAutoString label;
|
|
||||||
aElement->GetLabel(label);
|
|
||||||
menuitem->SetAttr(kNameSpaceID_None, nsGkAtoms::label, label, false);
|
|
||||||
|
|
||||||
nsAutoString icon;
|
|
||||||
aElement->GetIcon(icon);
|
|
||||||
if (!icon.IsEmpty()) {
|
|
||||||
menuitem->SetAttr(kNameSpaceID_None, nsGkAtoms::_class,
|
|
||||||
NS_LITERAL_STRING("menuitem-iconic"), false);
|
|
||||||
if (aCanLoadIcon) {
|
|
||||||
menuitem->SetAttr(kNameSpaceID_None, nsGkAtoms::image, icon, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool disabled;
|
|
||||||
aElement->GetDisabled(&disabled);
|
|
||||||
if (disabled) {
|
|
||||||
menuitem->SetAttr(kNameSpaceID_None, nsGkAtoms::disabled,
|
|
||||||
NS_LITERAL_STRING("true"), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return mCurrentNode->AppendChildTo(menuitem, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsXULContextMenuBuilder::AddSeparator()
|
|
||||||
{
|
|
||||||
if (!mFragment) {
|
|
||||||
return NS_ERROR_NOT_INITIALIZED;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<Element> menuseparator;
|
|
||||||
nsresult rv = CreateElement(nsGkAtoms::menuseparator, nullptr,
|
|
||||||
getter_AddRefs(menuseparator));
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
return mCurrentNode->AppendChildTo(menuseparator, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsXULContextMenuBuilder::UndoAddSeparator()
|
|
||||||
{
|
|
||||||
if (!mFragment) {
|
|
||||||
return NS_ERROR_NOT_INITIALIZED;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t count = mCurrentNode->GetChildCount();
|
|
||||||
if (!count ||
|
|
||||||
mCurrentNode->GetChildAt(count - 1)->Tag() != nsGkAtoms::menuseparator) {
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
mCurrentNode->RemoveChildAt(count - 1, false);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsXULContextMenuBuilder::CloseContainer()
|
|
||||||
{
|
|
||||||
if (!mFragment) {
|
|
||||||
return NS_ERROR_NOT_INITIALIZED;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mCurrentNode == mFragment) {
|
|
||||||
mCurrentNode = nullptr;
|
|
||||||
} else {
|
|
||||||
nsIContent* parent = mCurrentNode->GetParent();
|
|
||||||
mCurrentNode = parent->GetParent();
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsXULContextMenuBuilder::Init(nsIDOMDocumentFragment* aDocumentFragment,
|
|
||||||
const nsAString& aGeneratedItemIdAttrName)
|
|
||||||
{
|
|
||||||
NS_ENSURE_ARG_POINTER(aDocumentFragment);
|
|
||||||
|
|
||||||
mFragment = do_QueryInterface(aDocumentFragment);
|
|
||||||
mDocument = mFragment->GetOwnerDocument();
|
|
||||||
mGeneratedItemIdAttr = do_GetAtom(aGeneratedItemIdAttrName);
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsXULContextMenuBuilder::Click(const nsAString& aGeneratedItemId)
|
|
||||||
{
|
|
||||||
nsresult rv;
|
|
||||||
int32_t idx = nsString(aGeneratedItemId).ToInteger(&rv);
|
|
||||||
if (NS_SUCCEEDED(rv)) {
|
|
||||||
nsCOMPtr<nsIDOMHTMLElement> element = mElements.SafeObjectAt(idx);
|
|
||||||
if (element) {
|
|
||||||
element->DOMClick();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsXULContextMenuBuilder::CreateElement(nsIAtom* aTag,
|
|
||||||
nsIDOMHTMLElement* aHTMLElement,
|
|
||||||
Element** aResult)
|
|
||||||
{
|
|
||||||
*aResult = nullptr;
|
|
||||||
|
|
||||||
nsRefPtr<mozilla::dom::NodeInfo> nodeInfo = mDocument->NodeInfoManager()->GetNodeInfo(
|
|
||||||
aTag, nullptr, kNameSpaceID_XUL, nsIDOMNode::ELEMENT_NODE);
|
|
||||||
|
|
||||||
nsresult rv = NS_NewElement(aResult, nodeInfo.forget(), NOT_FROM_PARSER);
|
|
||||||
if (NS_FAILED(rv)) {
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsAutoString generateditemid;
|
|
||||||
|
|
||||||
if (aHTMLElement) {
|
|
||||||
mElements.AppendObject(aHTMLElement);
|
|
||||||
generateditemid.AppendInt(mCurrentGeneratedItemId++);
|
|
||||||
}
|
|
||||||
|
|
||||||
(*aResult)->SetAttr(kNameSpaceID_None, mGeneratedItemIdAttr, generateditemid,
|
|
||||||
false);
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
|
@ -1,51 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
#include "nsCOMPtr.h"
|
|
||||||
#include "nsCOMArray.h"
|
|
||||||
#include "nsIMenuBuilder.h"
|
|
||||||
#include "nsIXULContextMenuBuilder.h"
|
|
||||||
#include "nsCycleCollectionParticipant.h"
|
|
||||||
|
|
||||||
class nsIAtom;
|
|
||||||
class nsIContent;
|
|
||||||
class nsIDocument;
|
|
||||||
class nsIDOMHTMLElement;
|
|
||||||
|
|
||||||
namespace mozilla {
|
|
||||||
namespace dom {
|
|
||||||
class Element;
|
|
||||||
} // namespace dom
|
|
||||||
} // namespace mozilla
|
|
||||||
|
|
||||||
class nsXULContextMenuBuilder : public nsIMenuBuilder,
|
|
||||||
public nsIXULContextMenuBuilder
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
nsXULContextMenuBuilder();
|
|
||||||
|
|
||||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
||||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXULContextMenuBuilder,
|
|
||||||
nsIMenuBuilder)
|
|
||||||
NS_DECL_NSIMENUBUILDER
|
|
||||||
|
|
||||||
NS_DECL_NSIXULCONTEXTMENUBUILDER
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual ~nsXULContextMenuBuilder();
|
|
||||||
|
|
||||||
nsresult CreateElement(nsIAtom* aTag,
|
|
||||||
nsIDOMHTMLElement* aHTMLElement,
|
|
||||||
mozilla::dom::Element** aResult);
|
|
||||||
|
|
||||||
nsCOMPtr<nsIContent> mFragment;
|
|
||||||
nsCOMPtr<nsIDocument> mDocument;
|
|
||||||
nsCOMPtr<nsIAtom> mGeneratedItemIdAttr;
|
|
||||||
|
|
||||||
nsCOMPtr<nsIContent> mCurrentNode;
|
|
||||||
int32_t mCurrentGeneratedItemId;
|
|
||||||
|
|
||||||
nsCOMArray<nsIDOMHTMLElement> mElements;
|
|
||||||
};
|
|
|
@ -216,7 +216,7 @@ SharedFrameMetricsHelper::UpdateFromCompositorFrameMetrics(
|
||||||
fabsf(contentMetrics.mDisplayPort.x - compositorMetrics.mDisplayPort.x) <= 2 &&
|
fabsf(contentMetrics.mDisplayPort.x - compositorMetrics.mDisplayPort.x) <= 2 &&
|
||||||
fabsf(contentMetrics.mDisplayPort.y - compositorMetrics.mDisplayPort.y) <= 2 &&
|
fabsf(contentMetrics.mDisplayPort.y - compositorMetrics.mDisplayPort.y) <= 2 &&
|
||||||
fabsf(contentMetrics.mDisplayPort.width - compositorMetrics.mDisplayPort.width) <= 2 &&
|
fabsf(contentMetrics.mDisplayPort.width - compositorMetrics.mDisplayPort.width) <= 2 &&
|
||||||
fabsf(contentMetrics.mDisplayPort.height - compositorMetrics.mDisplayPort.height)) {
|
fabsf(contentMetrics.mDisplayPort.height - compositorMetrics.mDisplayPort.height) <= 2) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,150 +96,6 @@ TextureTargetForAndroidPixelFormat(android::PixelFormat aFormat)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GrallocTextureSourceOGL::GrallocTextureSourceOGL(CompositorOGL* aCompositor,
|
|
||||||
GrallocTextureHostOGL* aTextureHost,
|
|
||||||
android::GraphicBuffer* aGraphicBuffer,
|
|
||||||
gfx::SurfaceFormat aFormat)
|
|
||||||
: mCompositor(aCompositor)
|
|
||||||
, mTextureHost(aTextureHost)
|
|
||||||
, mGraphicBuffer(aGraphicBuffer)
|
|
||||||
, mEGLImage(0)
|
|
||||||
, mFormat(aFormat)
|
|
||||||
, mNeedsReset(true)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(mGraphicBuffer.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
GrallocTextureSourceOGL::~GrallocTextureSourceOGL()
|
|
||||||
{
|
|
||||||
DeallocateDeviceData();
|
|
||||||
mCompositor = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
GrallocTextureSourceOGL::BindTexture(GLenum aTextureUnit, gfx::Filter aFilter)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* The job of this function is to ensure that the texture is tied to the
|
|
||||||
* android::GraphicBuffer, so that texturing will source the GraphicBuffer.
|
|
||||||
*
|
|
||||||
* To this effect we create an EGLImage wrapping this GraphicBuffer,
|
|
||||||
* using EGLImageCreateFromNativeBuffer, and then we tie this EGLImage to our
|
|
||||||
* texture using fEGLImageTargetTexture2D.
|
|
||||||
*/
|
|
||||||
MOZ_ASSERT(gl());
|
|
||||||
if (!IsValid() || !gl()->MakeCurrent()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLuint tex = GetGLTexture();
|
|
||||||
GLuint textureTarget = GetTextureTarget();
|
|
||||||
|
|
||||||
gl()->fActiveTexture(aTextureUnit);
|
|
||||||
gl()->fBindTexture(textureTarget, tex);
|
|
||||||
|
|
||||||
ApplyFilterToBoundTexture(gl(), aFilter, textureTarget);
|
|
||||||
|
|
||||||
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
|
|
||||||
if (mTextureHost) {
|
|
||||||
// Wait until it's ready.
|
|
||||||
mTextureHost->WaitAcquireFenceSyncComplete();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GrallocTextureSourceOGL::Lock()
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(IsValid());
|
|
||||||
if (!IsValid()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!gl()->MakeCurrent()) {
|
|
||||||
NS_WARNING("Failed to make the gl context current");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
mTexture = mCompositor->GetTemporaryTexture(GetTextureTarget(), LOCAL_GL_TEXTURE0);
|
|
||||||
|
|
||||||
GLuint textureTarget = GetTextureTarget();
|
|
||||||
|
|
||||||
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
|
|
||||||
gl()->fBindTexture(textureTarget, mTexture);
|
|
||||||
if (!mEGLImage) {
|
|
||||||
mEGLImage = EGLImageCreateFromNativeBuffer(gl(), mGraphicBuffer->getNativeBuffer());
|
|
||||||
}
|
|
||||||
gl()->fEGLImageTargetTexture2D(textureTarget, mEGLImage);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
GrallocTextureSourceOGL::IsValid() const
|
|
||||||
{
|
|
||||||
return !!gl() && !!mGraphicBuffer.get() && !!mCompositor;
|
|
||||||
}
|
|
||||||
|
|
||||||
gl::GLContext*
|
|
||||||
GrallocTextureSourceOGL::gl() const
|
|
||||||
{
|
|
||||||
return mCompositor ? mCompositor->gl() : nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
GrallocTextureSourceOGL::SetCompositor(Compositor* aCompositor)
|
|
||||||
{
|
|
||||||
if (mCompositor && !aCompositor) {
|
|
||||||
DeallocateDeviceData();
|
|
||||||
}
|
|
||||||
mCompositor = static_cast<CompositorOGL*>(aCompositor);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
GLenum
|
|
||||||
GrallocTextureSourceOGL::GetTextureTarget() const
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(gl());
|
|
||||||
MOZ_ASSERT(mGraphicBuffer.get());
|
|
||||||
|
|
||||||
if (!gl() || !mGraphicBuffer.get()) {
|
|
||||||
return LOCAL_GL_TEXTURE_EXTERNAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// SGX has a quirk that only TEXTURE_EXTERNAL works and any other value will
|
|
||||||
// result in black pixels when trying to draw from bound textures.
|
|
||||||
// Unfortunately, using TEXTURE_EXTERNAL on Adreno has a terrible effect on
|
|
||||||
// performance.
|
|
||||||
// See Bug 950050.
|
|
||||||
if (gl()->Renderer() == gl::GLRenderer::SGX530 ||
|
|
||||||
gl()->Renderer() == gl::GLRenderer::SGX540) {
|
|
||||||
return LOCAL_GL_TEXTURE_EXTERNAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TextureTargetForAndroidPixelFormat(mGraphicBuffer->getPixelFormat());
|
|
||||||
}
|
|
||||||
|
|
||||||
gfx::IntSize
|
|
||||||
GrallocTextureSourceOGL::GetSize() const
|
|
||||||
{
|
|
||||||
if (!IsValid()) {
|
|
||||||
NS_WARNING("Trying to access the size of an invalid GrallocTextureSourceOGL");
|
|
||||||
return gfx::IntSize(0, 0);
|
|
||||||
}
|
|
||||||
return gfx::IntSize(mGraphicBuffer->getWidth(), mGraphicBuffer->getHeight());
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
GrallocTextureSourceOGL::DeallocateDeviceData()
|
|
||||||
{
|
|
||||||
if (mEGLImage) {
|
|
||||||
MOZ_ASSERT(mCompositor);
|
|
||||||
if (!gl() || !gl()->MakeCurrent()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
EGLImageDestroy(gl(), mEGLImage);
|
|
||||||
mEGLImage = EGL_NO_IMAGE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GrallocTextureHostOGL::GrallocTextureHostOGL(TextureFlags aFlags,
|
GrallocTextureHostOGL::GrallocTextureHostOGL(TextureFlags aFlags,
|
||||||
const NewSurfaceDescriptorGralloc& aDescriptor)
|
const NewSurfaceDescriptorGralloc& aDescriptor)
|
||||||
: TextureHost(aFlags)
|
: TextureHost(aFlags)
|
||||||
|
@ -272,9 +128,6 @@ void
|
||||||
GrallocTextureHostOGL::SetCompositor(Compositor* aCompositor)
|
GrallocTextureHostOGL::SetCompositor(Compositor* aCompositor)
|
||||||
{
|
{
|
||||||
mCompositor = static_cast<CompositorOGL*>(aCompositor);
|
mCompositor = static_cast<CompositorOGL*>(aCompositor);
|
||||||
if (mTilingTextureSource) {
|
|
||||||
mTilingTextureSource->SetCompositor(mCompositor);
|
|
||||||
}
|
|
||||||
if (mGLTextureSource) {
|
if (mGLTextureSource) {
|
||||||
mGLTextureSource->SetCompositor(mCompositor);
|
mGLTextureSource->SetCompositor(mCompositor);
|
||||||
}
|
}
|
||||||
|
@ -312,10 +165,6 @@ GrallocTextureHostOGL::GetFormat() const
|
||||||
void
|
void
|
||||||
GrallocTextureHostOGL::DeallocateSharedData()
|
GrallocTextureHostOGL::DeallocateSharedData()
|
||||||
{
|
{
|
||||||
if (mTilingTextureSource) {
|
|
||||||
mTilingTextureSource->ForgetBuffer();
|
|
||||||
mTilingTextureSource = nullptr;
|
|
||||||
}
|
|
||||||
if (mGLTextureSource) {
|
if (mGLTextureSource) {
|
||||||
mGLTextureSource = nullptr;
|
mGLTextureSource = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -339,10 +188,6 @@ GrallocTextureHostOGL::DeallocateSharedData()
|
||||||
void
|
void
|
||||||
GrallocTextureHostOGL::ForgetSharedData()
|
GrallocTextureHostOGL::ForgetSharedData()
|
||||||
{
|
{
|
||||||
if (mTilingTextureSource) {
|
|
||||||
mTilingTextureSource->ForgetBuffer();
|
|
||||||
mTilingTextureSource = nullptr;
|
|
||||||
}
|
|
||||||
if (mGLTextureSource) {
|
if (mGLTextureSource) {
|
||||||
mGLTextureSource = nullptr;
|
mGLTextureSource = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -351,9 +196,6 @@ GrallocTextureHostOGL::ForgetSharedData()
|
||||||
void
|
void
|
||||||
GrallocTextureHostOGL::DeallocateDeviceData()
|
GrallocTextureHostOGL::DeallocateDeviceData()
|
||||||
{
|
{
|
||||||
if (mTilingTextureSource) {
|
|
||||||
mTilingTextureSource->DeallocateDeviceData();
|
|
||||||
}
|
|
||||||
if (mGLTextureSource) {
|
if (mGLTextureSource) {
|
||||||
mGLTextureSource = nullptr;
|
mGLTextureSource = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -387,77 +229,24 @@ GrallocTextureHostOGL::GetRenderState()
|
||||||
|
|
||||||
TemporaryRef<gfx::DataSourceSurface>
|
TemporaryRef<gfx::DataSourceSurface>
|
||||||
GrallocTextureHostOGL::GetAsSurface() {
|
GrallocTextureHostOGL::GetAsSurface() {
|
||||||
if (mTilingTextureSource) {
|
android::GraphicBuffer* graphicBuffer = GetGraphicBufferFromDesc(mGrallocHandle).get();
|
||||||
return mTilingTextureSource->GetAsSurface();
|
|
||||||
} else {
|
|
||||||
android::GraphicBuffer* graphicBuffer = GetGraphicBufferFromDesc(mGrallocHandle).get();
|
|
||||||
uint8_t* grallocData;
|
|
||||||
int32_t rv = graphicBuffer->lock(GRALLOC_USAGE_SW_READ_OFTEN, reinterpret_cast<void**>(&grallocData));
|
|
||||||
RefPtr<gfx::DataSourceSurface> grallocTempSurf =
|
|
||||||
gfx::Factory::CreateWrappingDataSourceSurface(grallocData,
|
|
||||||
graphicBuffer->getStride() * android::bytesPerPixel(graphicBuffer->getPixelFormat()),
|
|
||||||
GetSize(), GetFormat());
|
|
||||||
RefPtr<gfx::DataSourceSurface> surf = CreateDataSourceSurfaceByCloning(grallocTempSurf);
|
|
||||||
|
|
||||||
graphicBuffer->unlock();
|
|
||||||
|
|
||||||
return surf.forget();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TemporaryRef<gfx::DataSourceSurface>
|
|
||||||
GrallocTextureSourceOGL::GetAsSurface() {
|
|
||||||
if (!IsValid()) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t* grallocData;
|
uint8_t* grallocData;
|
||||||
int32_t rv = mGraphicBuffer->lock(GRALLOC_USAGE_SW_READ_OFTEN, reinterpret_cast<void**>(&grallocData));
|
int32_t rv = graphicBuffer->lock(GRALLOC_USAGE_SW_READ_OFTEN, reinterpret_cast<void**>(&grallocData));
|
||||||
if (rv) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
RefPtr<gfx::DataSourceSurface> grallocTempSurf =
|
RefPtr<gfx::DataSourceSurface> grallocTempSurf =
|
||||||
gfx::Factory::CreateWrappingDataSourceSurface(grallocData,
|
gfx::Factory::CreateWrappingDataSourceSurface(grallocData,
|
||||||
mGraphicBuffer->getStride() * android::bytesPerPixel(mGraphicBuffer->getPixelFormat()),
|
graphicBuffer->getStride() * android::bytesPerPixel(graphicBuffer->getPixelFormat()),
|
||||||
GetSize(), GetFormat());
|
GetSize(), GetFormat());
|
||||||
|
|
||||||
RefPtr<gfx::DataSourceSurface> surf = CreateDataSourceSurfaceByCloning(grallocTempSurf);
|
RefPtr<gfx::DataSourceSurface> surf = CreateDataSourceSurfaceByCloning(grallocTempSurf);
|
||||||
|
|
||||||
mGraphicBuffer->unlock();
|
graphicBuffer->unlock();
|
||||||
|
|
||||||
return surf.forget();
|
return surf.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint
|
|
||||||
GrallocTextureSourceOGL::GetGLTexture()
|
|
||||||
{
|
|
||||||
return mTexture;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
GrallocTextureSourceOGL::BindEGLImage()
|
|
||||||
{
|
|
||||||
gl()->fEGLImageTargetTexture2D(GetTextureTarget(), mEGLImage);
|
|
||||||
}
|
|
||||||
|
|
||||||
TextureSource*
|
TextureSource*
|
||||||
GrallocTextureHostOGL::GetTextureSources()
|
GrallocTextureHostOGL::GetTextureSources()
|
||||||
{
|
{
|
||||||
// This is now only used with tiled layers, and will eventually be removed.
|
return nullptr;
|
||||||
// Other layer types use BindTextureSource instead.
|
|
||||||
MOZ_ASSERT(!mGLTextureSource);
|
|
||||||
if (!mTilingTextureSource) {
|
|
||||||
android::GraphicBuffer* graphicBuffer = GetGraphicBufferFromDesc(mGrallocHandle).get();
|
|
||||||
MOZ_ASSERT(graphicBuffer);
|
|
||||||
if (!graphicBuffer) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
mTilingTextureSource = new GrallocTextureSourceOGL(mCompositor, this,
|
|
||||||
graphicBuffer, mFormat);
|
|
||||||
}
|
|
||||||
mTilingTextureSource->Lock();
|
|
||||||
return mTilingTextureSource;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -529,8 +318,6 @@ GrallocTextureHostOGL::PrepareTextureSource(CompositableTextureSourceRef& aTextu
|
||||||
// because otherwise we would be modifying the content of every layer that uses
|
// because otherwise we would be modifying the content of every layer that uses
|
||||||
// the TextureSource in question, even thoug they don't use this TextureHost.
|
// the TextureSource in question, even thoug they don't use this TextureHost.
|
||||||
|
|
||||||
MOZ_ASSERT(!mTilingTextureSource);
|
|
||||||
|
|
||||||
android::GraphicBuffer* graphicBuffer = GetGraphicBufferFromDesc(mGrallocHandle).get();
|
android::GraphicBuffer* graphicBuffer = GetGraphicBufferFromDesc(mGrallocHandle).get();
|
||||||
|
|
||||||
MOZ_ASSERT(graphicBuffer);
|
MOZ_ASSERT(graphicBuffer);
|
||||||
|
|
|
@ -15,74 +15,6 @@
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace layers {
|
namespace layers {
|
||||||
|
|
||||||
class GrallocTextureHostOGL;
|
|
||||||
|
|
||||||
// Progressively getting replaced by GLTextureSource
|
|
||||||
class GrallocTextureSourceOGL : public TextureSource
|
|
||||||
, public TextureSourceOGL
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
friend class GrallocTextureHostOGL;
|
|
||||||
|
|
||||||
GrallocTextureSourceOGL(CompositorOGL* aCompositor,
|
|
||||||
GrallocTextureHostOGL* aTextureHost,
|
|
||||||
android::GraphicBuffer* aGraphicBuffer,
|
|
||||||
gfx::SurfaceFormat aFormat);
|
|
||||||
|
|
||||||
virtual ~GrallocTextureSourceOGL();
|
|
||||||
|
|
||||||
virtual bool IsValid() const MOZ_OVERRIDE;
|
|
||||||
|
|
||||||
virtual void BindTexture(GLenum aTextureUnit, gfx::Filter aFilter) MOZ_OVERRIDE;
|
|
||||||
|
|
||||||
virtual gfx::IntSize GetSize() const MOZ_OVERRIDE;
|
|
||||||
|
|
||||||
virtual TextureSourceOGL* AsSourceOGL() MOZ_OVERRIDE { return this; }
|
|
||||||
|
|
||||||
virtual GLenum GetTextureTarget() const MOZ_OVERRIDE;
|
|
||||||
|
|
||||||
virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE { return mFormat; }
|
|
||||||
|
|
||||||
virtual GLenum GetWrapMode() const MOZ_OVERRIDE
|
|
||||||
{
|
|
||||||
return LOCAL_GL_CLAMP_TO_EDGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeallocateDeviceData();
|
|
||||||
|
|
||||||
gl::GLContext* gl() const;
|
|
||||||
|
|
||||||
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
|
|
||||||
|
|
||||||
void ForgetBuffer()
|
|
||||||
{
|
|
||||||
mGraphicBuffer = nullptr;
|
|
||||||
mTextureHost = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
TemporaryRef<gfx::DataSourceSurface> GetAsSurface();
|
|
||||||
|
|
||||||
GLuint GetGLTexture();
|
|
||||||
|
|
||||||
void BindEGLImage();
|
|
||||||
|
|
||||||
EGLImage GetEGLImage()
|
|
||||||
{
|
|
||||||
return mEGLImage;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Lock();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
RefPtr<CompositorOGL> mCompositor;
|
|
||||||
GrallocTextureHostOGL* mTextureHost;
|
|
||||||
android::sp<android::GraphicBuffer> mGraphicBuffer;
|
|
||||||
EGLImage mEGLImage;
|
|
||||||
GLuint mTexture;
|
|
||||||
gfx::SurfaceFormat mFormat;
|
|
||||||
bool mNeedsReset;
|
|
||||||
};
|
|
||||||
|
|
||||||
class GrallocTextureHostOGL : public TextureHost
|
class GrallocTextureHostOGL : public TextureHost
|
||||||
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
|
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
|
||||||
, public TextureHostOGL
|
, public TextureHostOGL
|
||||||
|
@ -144,8 +76,6 @@ private:
|
||||||
NewSurfaceDescriptorGralloc mGrallocHandle;
|
NewSurfaceDescriptorGralloc mGrallocHandle;
|
||||||
RefPtr<GLTextureSource> mGLTextureSource;
|
RefPtr<GLTextureSource> mGLTextureSource;
|
||||||
RefPtr<CompositorOGL> mCompositor;
|
RefPtr<CompositorOGL> mCompositor;
|
||||||
// only used for tiling, will be removed.
|
|
||||||
RefPtr<GrallocTextureSourceOGL> mTilingTextureSource;
|
|
||||||
// Size reported by the GraphicBuffer
|
// Size reported by the GraphicBuffer
|
||||||
gfx::IntSize mSize;
|
gfx::IntSize mSize;
|
||||||
// Size reported by TextureClient, can be different in some cases (video?),
|
// Size reported by TextureClient, can be different in some cases (video?),
|
||||||
|
|
|
@ -27,11 +27,7 @@
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#if ANDROID_VERSION >= 21
|
#include <unistd.h>
|
||||||
#include <limits.h>
|
|
||||||
#else
|
|
||||||
#include <asm/page.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "mozilla/DebugOnly.h"
|
#include "mozilla/DebugOnly.h"
|
||||||
|
|
||||||
|
@ -1321,6 +1317,8 @@ EnsureKernelLowMemKillerParamsSet()
|
||||||
int32_t lowerBoundOfNextKillUnderKB = 0;
|
int32_t lowerBoundOfNextKillUnderKB = 0;
|
||||||
int32_t countOfLowmemorykillerParametersSets = 0;
|
int32_t countOfLowmemorykillerParametersSets = 0;
|
||||||
|
|
||||||
|
long page_size = sysconf(_SC_PAGESIZE);
|
||||||
|
|
||||||
for (int i = NUM_PROCESS_PRIORITY - 1; i >= 0; i--) {
|
for (int i = NUM_PROCESS_PRIORITY - 1; i >= 0; i--) {
|
||||||
// The system doesn't function correctly if we're missing these prefs, so
|
// The system doesn't function correctly if we're missing these prefs, so
|
||||||
// crash loudly.
|
// crash loudly.
|
||||||
|
@ -1358,7 +1356,7 @@ EnsureKernelLowMemKillerParamsSet()
|
||||||
adjParams.AppendPrintf("%d,", OomAdjOfOomScoreAdj(oomScoreAdj));
|
adjParams.AppendPrintf("%d,", OomAdjOfOomScoreAdj(oomScoreAdj));
|
||||||
|
|
||||||
// minfree is in pages.
|
// minfree is in pages.
|
||||||
minfreeParams.AppendPrintf("%d,", killUnderKB * 1024 / PAGE_SIZE);
|
minfreeParams.AppendPrintf("%ld,", killUnderKB * 1024 / page_size);
|
||||||
|
|
||||||
lowerBoundOfNextOomScoreAdj = oomScoreAdj;
|
lowerBoundOfNextOomScoreAdj = oomScoreAdj;
|
||||||
lowerBoundOfNextKillUnderKB = killUnderKB;
|
lowerBoundOfNextKillUnderKB = killUnderKB;
|
||||||
|
@ -1381,7 +1379,7 @@ EnsureKernelLowMemKillerParamsSet()
|
||||||
|
|
||||||
// notify_trigger is in pages.
|
// notify_trigger is in pages.
|
||||||
WriteToFile("/sys/module/lowmemorykiller/parameters/notify_trigger",
|
WriteToFile("/sys/module/lowmemorykiller/parameters/notify_trigger",
|
||||||
nsPrintfCString("%d", lowMemNotifyThresholdKB * 1024 / PAGE_SIZE).get());
|
nsPrintfCString("%ld", lowMemNotifyThresholdKB * 1024 / page_size).get());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure OOM events appear in logcat
|
// Ensure OOM events appear in logcat
|
||||||
|
|
|
@ -2242,7 +2242,7 @@ LIRGenerator::visitLoadSlot(MLoadSlot *ins)
|
||||||
MOZ_CRASH("typed load must have a payload");
|
MOZ_CRASH("typed load must have a payload");
|
||||||
|
|
||||||
default:
|
default:
|
||||||
define(new(alloc()) LLoadSlotT(useRegisterAtStart(ins->slots())), ins);
|
define(new(alloc()) LLoadSlotT(useRegisterForTypedLoad(ins->slots(), ins->type())), ins);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3088,13 +3088,16 @@ LIRGenerator::visitStoreTypedArrayElementHole(MStoreTypedArrayElementHole *ins)
|
||||||
void
|
void
|
||||||
LIRGenerator::visitLoadFixedSlot(MLoadFixedSlot *ins)
|
LIRGenerator::visitLoadFixedSlot(MLoadFixedSlot *ins)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(ins->object()->type() == MIRType_Object);
|
MDefinition *obj = ins->object();
|
||||||
|
MOZ_ASSERT(obj->type() == MIRType_Object);
|
||||||
|
|
||||||
if (ins->type() == MIRType_Value) {
|
MIRType type = ins->type();
|
||||||
LLoadFixedSlotV *lir = new(alloc()) LLoadFixedSlotV(useRegisterAtStart(ins->object()));
|
|
||||||
|
if (type == MIRType_Value) {
|
||||||
|
LLoadFixedSlotV *lir = new(alloc()) LLoadFixedSlotV(useRegisterAtStart(obj));
|
||||||
defineBox(lir, ins);
|
defineBox(lir, ins);
|
||||||
} else {
|
} else {
|
||||||
LLoadFixedSlotT *lir = new(alloc()) LLoadFixedSlotT(useRegisterAtStart(ins->object()));
|
LLoadFixedSlotT *lir = new(alloc()) LLoadFixedSlotT(useRegisterForTypedLoad(obj, type));
|
||||||
define(lir, ins);
|
define(lir, ins);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -482,6 +482,23 @@ LIRGeneratorShared::fillBoxUses(LInstruction *lir, size_t n, MDefinition *mir)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
LUse
|
||||||
|
LIRGeneratorShared::useRegisterForTypedLoad(MDefinition *mir, MIRType type)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(type != MIRType_Value && type != MIRType_None);
|
||||||
|
MOZ_ASSERT(mir->type() == MIRType_Object || mir->type() == MIRType_Slots);
|
||||||
|
|
||||||
|
#ifdef JS_PUNBOX64
|
||||||
|
// On x64, masm.loadUnboxedValue emits slightly less efficient code when
|
||||||
|
// the input and output use the same register and we're not loading an
|
||||||
|
// int32/bool/double, so we just call useRegister in this case.
|
||||||
|
if (type != MIRType_Int32 && type != MIRType_Boolean && type != MIRType_Double)
|
||||||
|
return useRegister(mir);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return useRegisterAtStart(mir);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace jit
|
} // namespace jit
|
||||||
} // namespace js
|
} // namespace js
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,8 @@ class LIRGeneratorShared : public MDefinitionVisitor
|
||||||
inline LAllocation useRegisterOrNonNegativeConstantAtStart(MDefinition *mir);
|
inline LAllocation useRegisterOrNonNegativeConstantAtStart(MDefinition *mir);
|
||||||
inline LAllocation useRegisterOrNonDoubleConstant(MDefinition *mir);
|
inline LAllocation useRegisterOrNonDoubleConstant(MDefinition *mir);
|
||||||
|
|
||||||
|
inline LUse useRegisterForTypedLoad(MDefinition *mir, MIRType type);
|
||||||
|
|
||||||
#ifdef JS_NUNBOX32
|
#ifdef JS_NUNBOX32
|
||||||
inline LUse useType(MDefinition *mir, LUse::Policy policy);
|
inline LUse useType(MDefinition *mir, LUse::Policy policy);
|
||||||
inline LUse usePayload(MDefinition *mir, LUse::Policy policy);
|
inline LUse usePayload(MDefinition *mir, LUse::Policy policy);
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
#
|
|
||||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
||||||
|
|
||||||
include $(topsrcdir)/config/rules.mk
|
|
||||||
|
|
||||||
componentdir = js/xpconnect/tests/components
|
|
||||||
libs:: $(DEPTH)/config/makefiles/xpidl/xpt/$(XPT_NAME)
|
|
||||||
$(INSTALL) $^ $(testxpcobjdir)/$(componentdir)/native
|
|
||||||
$(INSTALL) $^ $(testxpcobjdir)/$(componentdir)/js
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче