From: Pawel Kaczmarek
Date: Mon, 1 Jun 2015 10:23:27 +0000 (+0200)
Subject: [Common] GetRuntimeVariable - removing double quotes from app_id
X-Git-Tag: submit/tizen_tv/20150603.064601^2~55
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4958ac9f61dca23c16a6124aad91d90634628e5d;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git
[Common] GetRuntimeVariable - removing double quotes from app_id
[Info]
Crosswalk has used the double quote for the app_id from the first.
The n-wrt (new wrt) is using the double quote also but that's wrt and wrt-service's bug.
To keep compatibilities, two case of formats should be considered in webapi-plugins.
Change-Id: I69aaa06d5213d3d99f08f6393cf8249d30671346
Signed-off-by: Pawel Kaczmarek
---
diff --git a/src/common/extension.cc b/src/common/extension.cc
index 096f5ca2..d6e50548 100755
--- a/src/common/extension.cc
+++ b/src/common/extension.cc
@@ -145,7 +145,20 @@ std::string Extension::GetRuntimeVariable(const char* var_name, unsigned len) {
std::vector res(len + 1, 0);
g_runtime->GetRuntimeVariableString(xw_extension_, var_name, &res[0], len);
- return std::string(res.begin(), res.end());
+ // crosswalk has used the double quote for the app_id from the first.
+ // the n-wrt (new wrt) is using the double quote also.
+ // but that's wrt and wrt-service's bug.
+ // To keep compatibilities, two case of formats should be considered in webapi-plugins.
+ // removing double quote to keep compatibilities with new and old wrt
+ std::string value = std::string(res.begin(), res.end());
+ if (var_name == "app_id" && value.find('"', 0) != std::string::npos
+ && value.find('"', value.size() -1) != std::string::npos) {
+
+ value = value.erase(0, 1);
+ value = value.erase(value.size() - 1, 1);
+ }
+
+ return value;
}
// static