From a5ac0c1c80e4e26c27a43d04a0ae822fdf7b0425 Mon Sep 17 00:00:00 2001 From: Minggang Wang Date: Mon, 25 Apr 2016 18:04:45 +0800 Subject: [PATCH] [IAP]Throw an error when the options.channel is undefined If the options.channel is undefined, when passing it to navigator.iap.init() method, the Promise should be rejected and an error named "InvalidAccessError" is thrown also. BUG=XWALK-6798 --- iap/iap.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/iap/iap.js b/iap/iap.js index 8ea2759..10c4dff 100644 --- a/iap/iap.js +++ b/iap/iap.js @@ -37,6 +37,8 @@ exports.init = function(options) { return new Promise(function(resolve, reject) { if (g_initialized) throw new DOMError("InvalidStateError"); + if (typeof(options.channel) === "undefined") + throw new DOMError("InvalidAccessError"); var resolveWrapper = function() { g_initialized = true; resolve();