зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1044108 - Part 2: Disable QR decoder on Fennec for now. r=paul,gps
This commit is contained in:
Родитель
7748453d18
Коммит
d5006659db
|
@ -19,7 +19,14 @@ Object.defineProperty(this, "QRErrorCorrectLevel", {
|
|||
get: () => require("./encoder/index").QRErrorCorrectLevel
|
||||
});
|
||||
Object.defineProperty(this, "decoder", {
|
||||
get: () => require("./decoder/index")
|
||||
get: () => {
|
||||
// Some applications don't ship the decoder, see moz.build
|
||||
try {
|
||||
return require("./decoder/index");
|
||||
} catch(e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -86,6 +93,9 @@ exports.encodeToDataURI = function(message, quality, version) {
|
|||
* the QR code.
|
||||
*/
|
||||
exports.decodeFromURI = function(URI) {
|
||||
if (!decoder) {
|
||||
return promise.reject();
|
||||
}
|
||||
let deferred = promise.defer();
|
||||
decoder.decodeFromURI(URI, deferred.resolve, deferred.reject);
|
||||
return deferred.promise;
|
||||
|
@ -99,5 +109,8 @@ exports.decodeFromURI = function(URI) {
|
|||
* The data inside the QR code
|
||||
*/
|
||||
exports.decodeFromCanvas = function(canvas) {
|
||||
if (!decoder) {
|
||||
throw new Error("Decoder not available");
|
||||
}
|
||||
return decoder.decodeFromCanvas(canvas);
|
||||
};
|
||||
|
|
|
@ -5,10 +5,15 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
DIRS += [
|
||||
'decoder',
|
||||
'encoder'
|
||||
]
|
||||
|
||||
# Save file size on Fennec until there are active plans to use the decoder there
|
||||
if CONFIG['MOZ_BUILD_APP'] != 'mobile/android':
|
||||
DIRS += [
|
||||
'decoder'
|
||||
]
|
||||
|
||||
JS_MODULES_PATH = 'modules/devtools/qrcode'
|
||||
|
||||
EXTRA_JS_MODULES += [
|
||||
|
|
Загрузка…
Ссылка в новой задаче