]> source.dussan.org Git - vaadin-framework.git/commitdiff
fix: Add MPR UI id request parameter (#12412)
authorMikhail Shabarov <61410877+mshabarov@users.noreply.github.com>
Tue, 28 Sep 2021 08:01:19 +0000 (11:01 +0300)
committerGitHub <noreply@github.com>
Tue, 28 Sep 2021 08:01:19 +0000 (11:01 +0300)
* fix: Add MPR UI id request parameter

Related-to https://github.com/vaadin/multiplatform-runtime/issues/85

* test: Remove redundant non-empty param test

* test: Remove leftovers

* fix: Init window.mprUiId earlier than window.vaadin

* Add missing '='

server/src/main/resources/VAADIN/vaadinBootstrap.js
uitest/src/main/java/com/vaadin/tests/components/ui/UIInitBrowserDetails.java
uitest/src/test/java/com/vaadin/tests/components/ui/UIInitBrowserDetailsTest.java

index a6830f434b04865a757376c7826d9ff4930e4434..82e7482216604b821f1e5b051ee64e7a798bd5c0 100644 (file)
                 params += '&v-wn=' + encodeURIComponent(window.name);
             }
 
+            // This parameter is used in multiplatform-runtime as a key for
+            // storing the MPR UI content in the session
+            if (window.mprUiId) {
+                params += '&v-mui=' + encodeURIComponent(window.mprUiId);
+            }
+
             // Detect touch device support
             var supportsTouch = false;
             try {
index d362c5e6892673d19d76c380e8adb8adaf212694..8b97899baf38427ea8a0112a8a7f99843d0025f9 100644 (file)
@@ -37,6 +37,7 @@ public class UIInitBrowserDetails extends AbstractReindeerTestUI {
         addDetail("dst saving", "v-dstd", wb.getDSTSavings());
         addDetail("dst in effect", "v-dston", wb.isDSTInEffect());
         addDetail("current date", "v-curdate", wb.getCurrentDate());
+        addDetail("mpr ui id", "v-mui", "");
     }
 
     private void addDetail(String name, String param, Object value) {
index 71d68718839bc51f2a9919d0af8259b407532891..a3b5db11a84f44f0ae67501c2b5a25cc60d62852 100644 (file)
@@ -11,7 +11,7 @@ import com.vaadin.tests.tb3.MultiBrowserTest;
 public class UIInitBrowserDetailsTest extends MultiBrowserTest {
 
     @Test
-    public void testBrowserDetails() throws Exception {
+    public void testBrowserDetails() {
         openTestURL();
         /* location */
         compareRequestAndBrowserValue("v-loc", "location", "null");
@@ -23,6 +23,9 @@ public class UIInitBrowserDetailsTest extends MultiBrowserTest {
         compareRequestAndBrowserValue("v-sw", "screen width", "-1");
         /* screen height */
         compareRequestAndBrowserValue("v-sh", "screen height", "-1");
+        /* mpr ui id */
+        compareRequestAndBrowserValue("v-mui", "mpr ui id",
+                "any-non-empty-value");
         /* timezone offset */
         assertTextNotNull("timezone offset");
         /* raw timezone offset */