1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-03 17:59:28 +02:00

Update bluebird because the deprecated features are still available. Use same bluebird in browser.

This commit is contained in:
Simo Kinnunen 2014-09-05 15:32:21 +09:00
parent 77261ffd43
commit cc403ee553
5 changed files with 93 additions and 54 deletions

View file

@ -24,7 +24,6 @@
"angular-dialog-service": "~5.1.1", "angular-dialog-service": "~5.1.1",
"ng-file-upload": "~1.6.5", "ng-file-upload": "~1.6.5",
"angular-growl-v2": "JanStevens/angular-growl-2#~0.7.0", "angular-growl-v2": "JanStevens/angular-growl-2#~0.7.0",
"bluebird": "~2.1.3",
"angular-tree-control": "~0.2.2", "angular-tree-control": "~0.2.2",
"angular-loading-bar": "~0.5.1", "angular-loading-bar": "~0.5.1",
"underscore.string": "~2.3.3", "underscore.string": "~2.3.3",

View file

@ -1,17 +1,93 @@
// From here: https://github.com/android/platform_frameworks_base/blob/
// master/core/java/android/content/pm/PackageManager.java#L371
var responses = require('./response-codes.json')
module.exports = function installErrorFilter(gettext) { module.exports = function installErrorFilter(gettext) {
/*jshint maxlen:200*/
return function (text) { return function (text) {
switch (text) { switch (text) {
// Our error codes.
case "INSTALL_SUCCEEDED":
return gettext("Installation succeeded.")
case 'INSTALL_ERROR_UNKNOWN': case 'INSTALL_ERROR_UNKNOWN':
return gettext('Installation failed due to an unknown error.') return gettext('Installation failed due to an unknown error.')
case 'INSTALL_ERROR_TIMEOUT': case 'INSTALL_ERROR_TIMEOUT':
return gettext('Installation timed out.') return gettext('Installation timed out.')
// Android PackageManager error codes from [1].
// [1] https://github.com/android/platform_frameworks_base/blob/
// master/core/java/android/content/pm/PackageManager.java
case "INSTALL_FAILED_ALREADY_EXISTS":
return gettext("The package is already installed.")
case "INSTALL_FAILED_INVALID_APK":
return gettext("The package archive file is invalid.")
case "INSTALL_FAILED_INVALID_URI":
return gettext("The URI passed in is invalid.")
case "INSTALL_FAILED_INSUFFICIENT_STORAGE":
return gettext("The package manager service found that the device didn't have enough storage space to install the app.")
case "INSTALL_FAILED_DUPLICATE_PACKAGE":
return gettext("A package is already installed with the same name.")
case "INSTALL_FAILED_NO_SHARED_USER":
return gettext("The requested shared user does not exist.")
case "INSTALL_FAILED_UPDATE_INCOMPATIBLE":
return gettext("A previously installed package of the same name has a different signature than the new package (and the old package's data was not removed).")
case "INSTALL_FAILED_MISSING_SHARED_LIBRARY":
return gettext("The new package uses a shared library that is not available.")
case "INSTALL_FAILED_REPLACE_COULDNT_DELETE":
return gettext("The existing package could not be deleted.")
case "INSTALL_FAILED_DEXOPT":
return gettext("The new package failed while optimizing and validating its dex files, either because there was not enough storage or the validation failed.")
case "INSTALL_FAILED_OLDER_SDK":
return gettext("The new package failed because the current SDK version is older than that required by the package.")
case "INSTALL_FAILED_CONFLICTING_PROVIDER":
return gettext("The new package failed because it contains a content provider with thesame authority as a provider already installed in the system.")
case "INSTALL_FAILED_NEWER_SDK":
return gettext("The new package failed because the current SDK version is newer than that required by the package.")
case "INSTALL_FAILED_TEST_ONLY":
return gettext("The new package failed because it has specified that it is a test-only package and the caller has not supplied the INSTALL_ALLOW_TEST flag.")
case "INSTALL_FAILED_CPU_ABI_INCOMPATIBLE":
return gettext("The package being installed contains native code, but none that is compatible with the device's CPU_ABI.")
case "INSTALL_FAILED_MISSING_FEATURE":
return gettext("The new package uses a feature that is not available.")
case "INSTALL_FAILED_CONTAINER_ERROR":
return gettext("A secure container mount point couldn't be accessed on external media.")
case "INSTALL_FAILED_INVALID_INSTALL_LOCATION":
return gettext("The new package couldn't be installed in the specified install location.")
case "INSTALL_FAILED_MEDIA_UNAVAILABLE":
return gettext("The new package couldn't be installed in the specified install location because the media is not available.")
case "INSTALL_FAILED_VERIFICATION_TIMEOUT":
return gettext("The new package couldn't be installed because the verification timed out.")
case "INSTALL_FAILED_VERIFICATION_FAILURE":
return gettext("The new package couldn't be installed because the verification did not succeed.")
case "INSTALL_FAILED_PACKAGE_CHANGED":
return gettext("The package changed from what the calling program expected.")
case "INSTALL_FAILED_UID_CHANGED":
return gettext("The new package is assigned a different UID than it previously held.")
case "INSTALL_FAILED_VERSION_DOWNGRADE":
return gettext("The new package has an older version code than the currently installed package.")
case "INSTALL_PARSE_FAILED_NOT_APK":
return gettext("The parser was given a path that is not a file, or does not end with the expected '.apk' extension.")
case "INSTALL_PARSE_FAILED_BAD_MANIFEST":
return gettext("The parser was unable to retrieve the AndroidManifest.xml file.")
case "INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION":
return gettext("The parser encountered an unexpected exception.")
case "INSTALL_PARSE_FAILED_NO_CERTIFICATES":
return gettext("The parser did not find any certificates in the .apk.")
case "INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES":
return gettext("The parser found inconsistent certificates on the files in the .apk.")
case "INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING":
return gettext("The parser encountered a CertificateEncodingException in one of the files in the .apk.")
case "INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME":
return gettext("The parser encountered a bad or missing package name in the manifest.")
case "INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID":
return gettext("The parser encountered a bad shared user id name in the manifest.")
case "INSTALL_PARSE_FAILED_MANIFEST_MALFORMED":
return gettext("The parser encountered some structural problem in the manifest.")
case "INSTALL_PARSE_FAILED_MANIFEST_EMPTY":
return gettext("The parser did not find any actionable tags (instrumentation or application) in the manifest.")
case "INSTALL_FAILED_INTERNAL_ERROR":
return gettext("The system failed to install the package because of system issues.")
case "INSTALL_FAILED_USER_RESTRICTED":
return gettext("The system failed to install the package because the user is restricted from installing apps.")
case "INSTALL_FAILED_NO_MATCHING_ABIS":
return gettext("The system failed to install the package because its packaged native code did not match any of the ABIs supported by the system.")
default: default:
return gettext(responses[text] || text) return gettext(text)
} }
} }
} }

View file

@ -1,40 +0,0 @@
{
"INSTALL_SUCCEEDED": "Installation succeeded.",
"INSTALL_FAILED_ALREADY_EXISTS": "The package is already installed.",
"INSTALL_FAILED_INVALID_APK": "The package archive file is invalid.",
"INSTALL_FAILED_INVALID_URI": "The URI passed in is invalid.",
"INSTALL_FAILED_INSUFFICIENT_STORAGE": "The package manager service found that the device didn't have enough storage space to install the app.",
"INSTALL_FAILED_DUPLICATE_PACKAGE": "A package is already installed with the same name.",
"INSTALL_FAILED_NO_SHARED_USER": "The requested shared user does not exist.",
"INSTALL_FAILED_UPDATE_INCOMPATIBLE": "A previously installed package of the same name has a different signature than the new package (and the old package's data was not removed).",
"INSTALL_FAILED_MISSING_SHARED_LIBRARY": "The new package uses a shared library that is not available.",
"INSTALL_FAILED_REPLACE_COULDNT_DELETE": "The existing package could not be deleted.",
"INSTALL_FAILED_DEXOPT": "The new package failed while optimizing and validating its dex files, either because there was not enough storage or the validation failed.",
"INSTALL_FAILED_OLDER_SDK": "The new package failed because the current SDK version is older than that required by the package.",
"INSTALL_FAILED_CONFLICTING_PROVIDER": "The new package failed because it contains a content provider with thesame authority as a provider already installed in the system.",
"INSTALL_FAILED_NEWER_SDK": "The new package failed because the current SDK version is newer than that required by the package.",
"INSTALL_FAILED_TEST_ONLY": "The new package failed because it has specified that it is a test-only package and the caller has not supplied the INSTALL_ALLOW_TEST flag.",
"INSTALL_FAILED_CPU_ABI_INCOMPATIBLE": "The package being installed contains native code, but none that is compatible with the device's CPU_ABI.",
"INSTALL_FAILED_MISSING_FEATURE": "The new package uses a feature that is not available.",
"INSTALL_FAILED_CONTAINER_ERROR": "A secure container mount point couldn't be accessed on external media.",
"INSTALL_FAILED_INVALID_INSTALL_LOCATION": "The new package couldn't be installed in the specified install location.",
"INSTALL_FAILED_MEDIA_UNAVAILABLE": "The new package couldn't be installed in the specified install location because the media is not available.",
"INSTALL_FAILED_VERIFICATION_TIMEOUT": "The new package couldn't be installed because the verification timed out.",
"INSTALL_FAILED_VERIFICATION_FAILURE": "The new package couldn't be installed because the verification did not succeed.",
"INSTALL_FAILED_PACKAGE_CHANGED": "The package changed from what the calling program expected.",
"INSTALL_FAILED_UID_CHANGED": "The new package is assigned a different UID than it previously held.",
"INSTALL_FAILED_VERSION_DOWNGRADE": "The new package has an older version code than the currently installed package.",
"INSTALL_PARSE_FAILED_NOT_APK": "The parser was given a path that is not a file, or does not end with the expected '.apk' extension.",
"INSTALL_PARSE_FAILED_BAD_MANIFEST": "The parser was unable to retrieve the AndroidManifest.xml file.",
"INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION": "The parser encountered an unexpected exception.",
"INSTALL_PARSE_FAILED_NO_CERTIFICATES": "The parser did not find any certificates in the .apk.",
"INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES": "The parser found inconsistent certificates on the files in the .apk.",
"INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING": "The parser encountered a CertificateEncodingException in one of the files in the .apk.",
"INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME": "The parser encountered a bad or missing package name in the manifest.",
"INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID": "The parser encountered a bad shared user id name in the manifest.",
"INSTALL_PARSE_FAILED_MANIFEST_MALFORMED": "The parser encountered some structural problem in the manifest.",
"INSTALL_PARSE_FAILED_MANIFEST_EMPTY": "The parser did not find any actionable tags (instrumentation or application) in the manifest.",
"INSTALL_FAILED_INTERNAL_ERROR": "The system failed to install the package because of system issues.",
"INSTALL_FAILED_USER_RESTRICTED": "The system failed to install the package because the user is restricted from installing apps.",
"INSTALL_FAILED_NO_MATCHING_ABIS": "The system failed to install the package because its packaged native code did not match any of the ABIs supported by the system."
}

View file

@ -1,4 +1,10 @@
module.exports = function TransactionError(result) { function TransactionError(result) {
this.message = this.code = result.error this.code = this.message = result.error
this.result = result this.name = 'TransactionError'
Error.captureStackTrace(this, TransactionError)
} }
TransactionError.prototype = Object.create(Error.prototype);
TransactionError.prototype.constructor = TransactionError;
module.exports = TransactionError

View file

@ -30,8 +30,7 @@ module.exports = {
'angular-bootstrap': 'angular-bootstrap/ui-bootstrap-tpls', 'angular-bootstrap': 'angular-bootstrap/ui-bootstrap-tpls',
'localforage': 'localforage/dist/localforage.js', 'localforage': 'localforage/dist/localforage.js',
'socket.io': 'socket.io-client', 'socket.io': 'socket.io-client',
'oboe': 'oboe/dist/oboe-browser', 'oboe': 'oboe/dist/oboe-browser'
'bluebird': 'bluebird/js/browser/bluebird'
} }
}, },
module: { module: {
@ -57,8 +56,7 @@ module.exports = {
{ test: /oboe-browser\.js$/, loader: 'imports?define=>false!exports?oboe'}, { test: /oboe-browser\.js$/, loader: 'imports?define=>false!exports?oboe'},
{ test: /uuid\.js$/, loader: 'imports?require=>undefined'}, { test: /uuid\.js$/, loader: 'imports?require=>undefined'},
//{ test: /ui-bootstrap-tpls\.js$/, loader: 'script'}, //{ test: /ui-bootstrap-tpls\.js$/, loader: 'script'},
{ test: /dialogs\.js$/, loader: 'script'}, { test: /dialogs\.js$/, loader: 'script'}
{ test: /bluebird\.js$/, loader: 'imports?require=>undefined'}
], ],
preLoaders: [ preLoaders: [
{ {