Bug 978143 - Propagate APK install cancellation back to webpage. r=wesj

This commit is contained in:
Martyn Haigh 2014-06-05 02:21:00 -04:00
Родитель 9a463e901a
Коммит 5eaf262eda
2 изменённых файлов: 8 добавлений и 1 удалений

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

@ -183,7 +183,7 @@ public class EventListener implements NativeEventListener {
}
}
public static void installApk(final Activity context, NativeJSObject message, EventCallback callback) {
public static void installApk(final Activity context, NativeJSObject message, final EventCallback callback) {
final JSONObject messageData;
// We get the manifest url out of javascript here so we can use it as a checksum
@ -237,6 +237,7 @@ public class EventListener implements NativeEventListener {
// unregistered the receiver).
Log.e(LOGTAG, "error unregistering install receiver: ", e);
}
callback.sendError("APK installation cancelled by user");
}
}
});

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

@ -500,6 +500,12 @@ this.WebappManager = {
type: "Webapps:InstallApk",
filePath: apk.filePath,
data: msg,
}, (data, error) => {
if (!!error) {
// There's no page to report back to so drop the error.
// TODO: we should notify the user about this failure.
debug("APK install failed : " + returnError);
}
});
}
} else {