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
parent 1d611b64cf
commit 2af66b77f0
2 changed files with 8 additions and 1 deletions

View File

@ -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");
}
}
});

View File

@ -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 {