mobile/android/base/tests/test_viewport.sjs

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5  function decodeQuery(query) {
     6    let result = {};
     7    query.split("&").forEach(function(pair) {
     8      let [key, val] = pair.split("=");
     9      result[key] = decodeURIComponent(val);
    10    });
    11    return result;
    12  }
    14 function handleRequest(request, response) {
    15   response.setStatusLine(request.httpVersion, 200, "OK");
    16   response.setHeader("Content-Type", "text/html", false);
    18   let params = decodeQuery(request.queryString || "");
    20   response.write('<html>\n' +
    21     '<head>\n' +
    22       '<title>Browser VKB Overlapping content</title>  <meta charset="utf-8">');
    24   if (params.metadata)
    25     response.write("<meta name=\"viewport\" content=\"" + params.metadata + "\"/>");
    27   /* Write a spacer div into the document, above an input element*/
    28   response.write('</head>\n' +
    29     '<body style="margin: 0; padding: 0">\n' +
    30       '<div style="width: 100%; height: 100%"></div>\n' +
    31       '<input type="text" style="background-color: green">\n' +
    32     '</body>\n</html>');
    33 }

mercurial