SPEC-3723: restructure meta-agl-demo
[AGL/meta-agl-demo.git] / recipes-wam / wam / files / trunc-webapp-roles.patch
1 From f31e93261f34abaa3dcdc4959963f5b5a8983002 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Jan-Simon=20M=C3=B6ller?= <jsmoeller@linuxfoundation.org>
3 Date: Thu, 25 Jun 2020 19:47:24 +0200
4 Subject: [PATCH] Set webapp roles that are max 12 characters long.
5
6 From: =?UTF-8?q?Jacobo=20Aragunde=20P=C3=A9rez?= <jaragunde@igalia.com>
7
8 This is a workaround for SPEC-3127. To prevent repeated roles as much
9 as possible, I'm using the appid as a basis instead of "Webapp-" +
10 host + port, which has many chances to be redundant in the first 12
11 chars.
12
13 Bug-AGL: SPEC-3127
14
15 ---
16  src/agl/WebRuntimeAGL.cpp | 10 +++-------
17  1 file changed, 3 insertions(+), 7 deletions(-)
18
19 diff --git a/src/agl/WebRuntimeAGL.cpp b/src/agl/WebRuntimeAGL.cpp
20 index aed928b..efd2ee4 100644
21 --- a/src/agl/WebRuntimeAGL.cpp
22 +++ b/src/agl/WebRuntimeAGL.cpp
23 @@ -274,7 +274,6 @@ int WebAppLauncherRuntime::run(int argc, const char** argv) {
24  
25    m_id = getAppId(args);
26    m_url = getAppUrl(args);
27 -  m_role = "WebApp";
28  
29    setup_signals();
30  
31 @@ -326,15 +325,9 @@ bool WebAppLauncherRuntime::init() {
32        if (n != std::string::npos) {
33          std::string sport = authority.substr(n+1);
34          m_host = authority.substr(0, n);
35 -        m_role.push_back('-');
36 -        m_role.append(m_host);
37 -        m_role.push_back('-');
38 -        m_role.append(sport);
39          m_port = stringTo<int>(sport);
40        } else {
41          m_host = authority;
42 -        m_role.push_back('-');
43 -        m_role.append(m_host);
44        }
45      }
46  
47 @@ -375,6 +368,9 @@ bool WebAppLauncherRuntime::init() {
48        m_role = "homescreen";
49      else if (m_id.rfind("webapps-homescreen", 0) == 0)
50        m_role = "homescreen";
51 +    else {
52 +      m_role = m_id.substr(0,12);
53 +    }
54  
55      LOG_DEBUG("id=[%s], name=[%s], role=[%s], url=[%s], host=[%s], port=%d, token=[%s], width=[%s], height[%s], surface_type[%d], panel_type[%d]",
56              m_id.c_str(), m_name.c_str(), m_role.c_str(), m_url.c_str(),