[Download] Add listener type checking
authorDeqing Huang <deqing.huang@intel.com>
Tue, 3 Dec 2013 10:47:12 +0000 (18:47 +0800)
committerDeqing Huang <deqing.huang@intel.com>
Fri, 6 Dec 2013 09:30:11 +0000 (17:30 +0800)
Bug: https://crosswalk-project.org/jira/browse/XWALK-601

download/download_api.js

index fb0691e..1e7594e 100644 (file)
@@ -242,7 +242,8 @@ exports.start = function(request, listener) {
     throw new tizen.WebAPIException(tizen.WebAPIException.TYPE_MISMATCH_ERR);
   }
   requests[request.uid] = request;
-  if (typeof listener != 'undefined') {
+  if (listener !== null) {
+    ensureType(listener, 'object');
     exports.setListener(request.uid, listener);
   }
   postMessage({