var validator_ = xwalk.utils.validator;
var types_ = validator_.Types;
var check_ = xwalk.utils.type;
+var converter_ = xwalk.utils.converter;
var callbackId = 0;
tizen.DownloadRequest = function(url, destination, fileName, networkType, httpHeader) {
validator_.isConstructorCall(this, tizen.DownloadRequest);
- var url_ = url;
+ var url_ = converter_.toString(url);
+ var destination_ = destination === undefined ? '' : converter_.toString(destination);
+ var fileName_ = fileName === undefined ? '' : converter_.toString(fileName);
+
var networkType_;
if (networkType === undefined || !(networkType in DownloadNetworkType)) {
},
set: function(value) {
if (value !== null) {
- url_ = value;
+ url_ = converter_.toString(value);
}
},
},
'destination': {
- writable: true,
enumerable: true,
- value: destination === undefined ? '' : destination,
+ get: function() {
+ return destination_;
+ },
+ set: function(value) {
+ if (value !== null) {
+ destination_ = converter_.toString(value);
+ }
+ },
},
'fileName': {
- writable: true,
enumerable: true,
- value: fileName === undefined ? '' : fileName,
+ get: function() {
+ return fileName_;
+ },
+ set: function(value) {
+ if (value !== null) {
+ fileName_ = converter_.toString(value);
+ }
+ },
},
'networkType': {
enumerable: true,
LoggerD("Entered");
CHECK_PRIVILEGE_ACCESS(kPrivilegeDownload, &out);
CHECK_EXIST(args, "callbackId", out)
+ CHECK_EXIST(args, "url", out)
int ret;
std::string networkType;
DownloadInfoPtr diPtr(new DownloadInfo);
diPtr->callbackId = static_cast<int>(args.get("callbackId").get<double>());
- diPtr->url = args.get("url").get<std::string>();
+ diPtr->url = args.get("url").is<std::string>() ? args.get("url").get<std::string>() : "";
if (!args.get("destination").is<picojson::null>()) {
- if (args.get("destination").get<std::string>() != "") {
+ if (args.get("destination").is<std::string>() && args.get("destination").get<std::string>() != "") {
diPtr->destination = args.get("destination").get<std::string>();
diPtr->destination = common::FilesystemProvider::Create().GetRealPath(diPtr->destination);
}
}
if (!args.get("fileName").is<picojson::null>()) {
- if (args.get("fileName").get<std::string>() != "") {
+ if (args.get("fileName").is<std::string>() && args.get("fileName").get<std::string>() != "") {
diPtr->file_name = args.get("fileName").get<std::string>();
}
}
if (!args.get("networkType").is<picojson::null>()) {
- networkType = args.get("networkType").get<std::string>();
+ networkType = args.get("networkType").is<std::string>() ?
+ args.get("networkType").get<std::string>() : "ALL";
}
bool network_support = false;