Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
[IAP]Throw an error when the order.productId is undefined
Browse files Browse the repository at this point in the history
If the order.produectId is undefined, when passing it to
navigator.iap.purchase() method, the Promise should be rejected and
an error named "InvalidAccessError" is thrown also.

BUG=XWALK-6895
  • Loading branch information
Minggang Wang committed May 18, 2016
1 parent 4bdd0dd commit a4615f0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions iap/iap.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ exports.purchase = function(order) {
if (!g_initialized) {
throw new DOMError("InvalidStateError");
}
if (typeof(order.productId) === "undefined") {
throw new DOMError("InvalidAccessError");
}
var requestId = createAsyncRequest(resolve, reject);
sendAsycRequest("purchase", requestId, order);
});
Expand Down

0 comments on commit a4615f0

Please sign in to comment.