Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

www.ozon.ru - site is not usable #9541

Closed
webcompat-bot opened this issue Sep 2, 2017 · 14 comments
Closed

www.ozon.ru - site is not usable #9541

webcompat-bot opened this issue Sep 2, 2017 · 14 comments
Labels
browser-firefox-mobile engine-gecko The browser uses the Gecko rendering engine severity-critical The site or core functionality is unusable, or you would probably open another browser to use it. type-uaoverride Require a UA override for working
Milestone

Comments

@webcompat-bot
Copy link

URL: https://www.ozon.ru/context/detail/id/3115179/

Browser / Version: Firefox Mobile 57.0
Operating System: Android 7.0
Tested Another Browser: Unknown

Problem type: Site is not usable
Description: pages layout is completely broken
Steps to Reproduce:

From webcompat.com with ❤️

@MDTsai
Copy link

MDTsai commented Sep 4, 2017

Confirmed, looks good in Chrome mobile but bad on Firefox mobile. Move to needsdiagnosis.

@wisniewskit
Copy link
Member

I see mention of Mobify in their source, and it looks like simply spoofing the UA to Chrome isn't giving the same results that Chrome gets. Looks like this will be a lengthy diagnosis.

@karlcow
Copy link
Member

karlcow commented Apr 23, 2018

This is the part using Mobify.

    ! function(e, i, t, o, n) {
        function r(e, t, o, n) {
            var r = i.getElementsByTagName("script")[0];
            n.src ? e.src = n.src : n.innerHTML && (e.innerHTML = n.innerHTML), e.id = t, e.setAttribute("class", o), r.parentNode.insertBefore(e, r)
        }
        e.Mobify = {
            points: [+new
                Date
            ]
        };
        var s = /((; )|#|&|^)mobify=(\d)/.exec(location.hash + ";" + i.cookie);
        if (s && s[3]) {
            if (!+s[3]) return
        } else
        if (!t()) return;
        i.write('<div id="eski-overlay" style="font-family:Helvetica-Light,Helvetica,Arial,sans-serif;font-weight:light;font-size:300%;line-height:100%;position:absolute;top:42%;left:0;right:0;text-align:center;color: #999;"><img src="https://ozon-st.cdn.ngenix.net/mobileapp/static/five-dots.svg"></div><plaintext style="display:none">'), setTimeout(function() {
            var t = e.Mobify = e.Mobify || {};
            t.capturing = !0;
            var
                s = i.createElement("script"),
                a = function() {
                    var
                        t, o = new Date,
                        n = "eski-fail-req-coount",
                        r = 8,
                        s = sessionStorage.getItem(n) || 0;
                    r > s ? (s++, t = 100) : (s = 0, t = 18e5), sessionStorage.setItem(n, s), o.setTime(o.getTime() + t), i.cookie = "mobify=0;expires=" + o.toGMTString() + "; path=/", e.location = e.location.href
                };
            s.onload = function() {
                if (n) {
                    var
                        e = i.createElement("script");
                    if (e.onerror = a, "string" == typeof n) r(e, "main-executable", "mobify", {
                        src: n
                    });
                    else {
                        var
                            t = "var main = " + n.toString() + "; main();";
                        r(e, "main-executable", "mobify", {
                            innerHTML: t
                        })
                    }
                }
            }, s.onerror = a, r(s, "mobify-js", "mobify", {
                src: o
            })
        })
    }(window, document, function() {
        var
            e = navigator.userAgent || navigator.vendor || window.opera,
            i = !1;
        return /mobi|phone|ipod|nokia/i.test(e) && (i = !0), (/msie|windows|media\scenter|opera\smini|ipad|android\s3|android\s2|iphone\sos\s(4|5|6)|ipad\sos\s(4|5|6)|fennec|android(.*)firefox/i.test(e) || Math.min(screen.width,
            screen.height) > 767) && (i = !1), i
    }, "/eskimobi/eski.mobi.min.js", "/eskimobi/mobi.js");

the i.write( there is a document.write and I have the feeling it destroys the context of the page.

I wonder if it's a similar instance of https://miketaylr.com/posts/2014/08/document-writing-zeptos.html

And Chromium project seems to want to keep their behavior.
https://bugs.chromium.org/p/chromium/issues/detail?id=149785#c15

@karlcow
Copy link
Member

karlcow commented Apr 23, 2018

@miketaylr
Copy link
Member

Should we open an issue about that on Bugzilla wrt to

@karlcow probably, at least to track See Also bugs. Perhaps with a title "Consider matching Blink/WebKit behavior for document.open and new window global" (or similar)

@karlcow
Copy link
Member

karlcow commented Apr 23, 2018

@karlcow
Copy link
Member

karlcow commented May 15, 2018

@karlcow karlcow closed this as completed May 15, 2018
@karlcow karlcow modified the milestones: needsdiagnosis, duplicate May 15, 2018
@miketaylr miketaylr reopened this Mar 11, 2019
@miketaylr miketaylr modified the milestones: duplicate, needsdiagnosis Mar 11, 2019
@miketaylr
Copy link
Member

https://bugzilla.mozilla.org/show_bug.cgi?id=1456313 is fixed now. I'm not sure what this site looked like before, so it's hard to compare what might have changed. The mobile -optimized menu looks good, but the rest of the content overflows the viewport.

@karlcow, can you take a look please?

@miketaylr miketaylr added the status-needsinfo-karlcow ping @karlcow label Mar 11, 2019
@karlcow
Copy link
Member

karlcow commented Mar 11, 2019

Taking screenshots so we have a memory of the current state as of today.

Firefox

Screenshot Description

Chrome

Screenshot Description

We can see the top menu is correct. things are going wild after the top menu.

There's no error on the console log on Firefox, but a couple of warnings.

07:36:45.395 Request to access cookie or storage on “https://radar.cedexis.com/1/23948/radar.js” was blocked because it came from a tracker and content blocking is enabled.
3115179
07:36:46.557 Can not find namespace: services/tiles_service/item_parser(Services.TilesService.ItemParser)! bozon.min.1251.js:11:24306
07:36:46.563 Can not find namespace: modules/product_view_module(Modules.ProductViewModule)! bozon.min.1251.js:11:24306
07:36:46.939 Can not find namespace: elements/ui/popup/popup=hbs(Elements.Ui.Popup.Popup=hbs)! bozon.min.1251.js:11:24306
07:36:47.039 Core.Nexus.View warning: please, do not call .render()  from .initialize(). This feature will be removed soon
bozon.min.1251.js:9:30706
07:36:47.132 Core.Nexus.View warning: please, do not call .render()  from .initialize(). This feature will be removed soon bozon.min.1251.js:9:30706
07:36:47.253 Can not find namespace: Pages.Detail.useFakeSaleBlock(Pages.Detail.useFakeSaleBlock)! bozon.min.1251.js:11:24306
07:36:47.436 Request to access cookie or storage on “https://radar.cedexis.com/1551894114/radar.js” was blocked because it came from a tracker and content blocking is enabled.
3115179
07:36:47.478 Request to access cookie or storage on “https://www.googletagmanager.com/gtm.js?id=GTM-M28PLG” was blocked because it came from a tracker and content blocking is enabled.
3115179
07:36:47.548 Core.Nexus.View warning: please, do not call .render()  from .initialize(). This feature will be removed soon bozon.min.1251.js:9:30706
07:36:47.893 Loading failed for the <script> with source “https://st.dynamicyield.com/st?sec=8766520&inHead=true&id=0&ref=&sr=360x640&altip=&ctx=%7B%22type%22%3A%22PRODUCT%22%2C%22data%22%3A%5B%223115179%22%5D%7D”. 3115179:1:1
07:36:47.924 Loading failed for the <script> with source “https://js-agent.newrelic.com/nr-1118.min.js”. 3115179:1:1
07:36:48.028 Request to access cookie or storage on “https://js-agent.newrelic.com/nr-1118.min.js” was blocked because it came from a tracker and content blocking is enabled.
3115179
07:36:48.038 RTCIceServer.url is deprecated! Use urls instead.
ozon_120_06fd1608_196_426.js:391
07:36:50.026 Core.Nexus.View warning: please, do not call .render()  from .initialize(). This feature will be removed soon bozon.min.1251.js:9:30706
07:36:54.315 Request to access cookie or storage on “https://media-akam.licdn.com/cdo/cdxs/r20.gif?rnd=1-1-23948-0-0-16482-1614040164-_CgJqMRAUGHAiBggBEIy7ASjkmNGBBjDX3144gsab5AVAor3SgwZKDwgEEGsYl2ggACipiYCgBFAAWgoIABAAGAAgACgAYAFqE2J1dHRvbjIuaGtnLmh2LnByb2SCAQ8IBBBrGOBMIAAok4mAoASIAdKF1xGQAQCYAQA” was blocked because it came from a tracker and content blocking is enabled.
3115179
07:36:54.571 Request to access cookie or storage on “https://media-akam.licdn.com/cdo/cdxs/r20.gif?rnd=0-1-23948-0-0-16482-1614040164-_CgJqMRAUGHAiBggBEIy7ASjkmNGBBjDX3144gsab5AVAor3SgwZKDwgEEGsYl2ggACipiYCgBFAAWgoIABAAGAAgACgAYAFqE2J1dHRvbjIuaGtnLmh2LnByb2SCAQ8IBBBrGOBMIAAok4mAoASIAdKF1xGQAQCYAQA” was blocked because it came from a tracker and content blocking is enabled.
3115179
07:36:55.000 Request to access cookie or storage on “https://s.pinimg.com/_/_/r20.gif?rnd=1-1-23948-0-0-34022-1614040164-_CgJqMRAUGHAiBggBEIy7ASjkmNGBBjDX3144gsab5AVAor3SgwZKDwgEEGsYl2ggACipiYCgBFAAWgoIABAAGAAgACgAYAFqE2J1dHRvbjIuaGtnLmh2LnByb2SCAQ8IBBBrGOBMIAAok4mAoASIAdKF1xGQAQCYAQA” was blocked because it came from a tracker and content blocking is enabled.
3115179
07:36:55.234 Request to access cookie or storage on “https://s.pinimg.com/_/_/r20.gif?rnd=0-1-23948-0-0-34022-1614040164-_CgJqMRAUGHAiBggBEIy7ASjkmNGBBjDX3144gsab5AVAor3SgwZKDwgEEGsYl2ggACipiYCgBFAAWgoIABAAGAAgACgAYAFqE2J1dHRvbjIuaGtnLmh2LnByb2SCAQ8IBBBrGOBMIAAok4mAoASIAdKF1xGQAQCYAQA” was blocked because it came from a tracker and content blocking is enabled.
3115179
07:37:00.263 The script from “https://36c82b15-be32-6cba-5f76-5c98530c62e9.rum-reflector.ngenix.net/data.json?jsonp=_8011118f7c4ea85f3f0c9abbc8f2b242” was loaded even though its MIME type (“application/json”) is not a valid JavaScript MIME type.
3115179

​```

@karlcow karlcow self-assigned this Mar 11, 2019
@karlcow
Copy link
Member

karlcow commented Mar 12, 2019

The header is identified as eHeader_MobileWrap in both firefox and chrome, but html has

<html xmlns="http://www.w3.org/1999/xhtml" prefix="og: http://ogp.me/ns#" class=" gecko   touch" lang="ru">

and

<html class=" mobile android linux  touch">

If I set these class values on html, mobile android linux touch, it fixes a couple of things in Firefox but not everything.

so the initial issue has been fixed, but the UA sniffing is still not solved.
and fwiw setting Chrome with a firefox UA creates the same exact issue in Chrome.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
  lang="ru"
  xmlns="http://www.w3.org/1999/xhtml"
  prefix="og: http://ogp.me/ns#"
>
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <!--eski.mobi-->
    <script class="eskimobi" data-type="mobile">
      !(function(e, i, t, o, n) {
        function r(e, t, o, n) {
          var r = i.getElementsByTagName("script")[0];
          n.src ? (e.src = n.src) : n.innerHTML && (e.innerHTML = n.innerHTML),
            (e.id = t),
            e.setAttribute("class", o),
            r.parentNode.insertBefore(e, r);
        }
        e.Mobify = { points: [+new Date()] };
        var s = /((; )|#|&|^)mobify=(\d)/.exec(location.hash + "; " + i.cookie);
        if (s && s[3]) {
          if (!+s[3]) return;
        } else if (!t()) return;
        i.write(
          '<div id="eski-overlay" style="font-family:Helvetica-Light,Helvetica,Arial,sans-serif;font-weight:light;font-size:300%;line-height:100%;position:absolute;top:42%;left:0;right:0;text-align:center;color: #999;"><img src="https://ozon-st.cdn.ngenix.net/mobileapp/static/five-dots.svg"></div><plaintext style="display:none">'
        ),
          setTimeout(function() {
            var t = (e.Mobify = e.Mobify || {});
            t.capturing = !0;
            var s = i.createElement("script"),
              a = function() {
                var t,
                  o = new Date(),
                  n = "eski-fail-req-coount",
                  r = 8,
                  s = sessionStorage.getItem(n) || 0;
                r > s ? (s++, (t = 100)) : ((s = 0), (t = 18e5)),
                  sessionStorage.setItem(n, s),
                  o.setTime(o.getTime() + t),
                  (i.cookie =
                    "mobify=0; expires=" + o.toGMTString() + "; path=/"),
                  (e.location = e.location.href);
              };
            (s.onload = function() {
              if (n) {
                var e = i.createElement("script");
                if (((e.onerror = a), "string" == typeof n))
                  r(e, "main-executable", "mobify", { src: n });
                else {
                  var t = "var main = " + n.toString() + "; main();";
                  r(e, "main-executable", "mobify", { innerHTML: t });
                }
              }
            }),
              (s.onerror = a),
              r(s, "mobify-js", "mobify", { src: o });
          });
      })(
        window,
        document,
        function() {
          var e = navigator.userAgent || navigator.vendor || window.opera,
            i = !1;
          return (
            /mobi|phone|ipod|nokia/i.test(e) && (i = !0),
            (/msie|windows|media\scenter|opera\smini|ipad|android\s3|android\s2|iphone\sos\s(4|5|6)|ipad\sos\s(4|5|6)|fennec|android(.*)firefox/i.test(
              e
            ) ||
              Math.min(screen.width, screen.height) > 767) &&
              (i = !1),
            i
          );
        },
        "https://www.ozon.ru/eskimobi/eski.mobi.min.js",
        "https://www.ozon.ru/eskimobi/mobi.js"
      );
</script>

Then we get

      (function() {
        var ua,
          mobile = false,
          hasEski = window.eskimobi || false,
          MOBILE_MAX_SCREEN = 768;

        if (document.cookie.indexOf("mobi-path") <= 0) {
          try {
            var isLittleScreen =
              Math.min(screen.width, screen.height) < MOBILE_MAX_SCREEN;

            ua = navigator.userAgent || navigator.vendor || window.opera;

            if (/mobi|phone|ipod|nokia/i.test(ua)) {
              mobile = true;
            }

            if (
              /msie|windows|media\scenter|opera\smini|ipad|android\s3|android\s2|iphone\sos\s(4|5|6)|ipad\sos\s(4|5|6)/i.test(
                ua
              ) ||
              !isLittleScreen
            ) {
              mobile = false;
            }

            document.cookie = "isLittleScreen=" + isLittleScreen;

            window.weGoMobile = mobile;

            mobile &&
              document.write(
                '<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />'
              );
          } catch (err) {}
        } else {
          document.querySelector("html").classList.add("forceDesktop");
        }

        // Load CSS Files

        ozonCombinedStyles.forEach(function(info) {
          var path = info.domain + "/res/" + (mobile ? "m/" : "") + info.path;

          if (hasEski && mobile) {
            info.position === "MobileReady" &&
              document.write(
                '<link rel="Stylesheet" type="text/css" href="' + path + '" \/>'
              );
          } else {
            document.write(
              '<link rel="Stylesheet" type="text/css" href="' + path + '" \/>'
            );
          }
        });

        ozonSiteStyles.forEach(function(path) {
          path = mobile ? path.replace("/v_", "/m_") : path;

          document.write(
            '<link rel="Stylesheet" type="text/css" href="' + path + '" \/>'
          );
        });

        // Safe legacy injections

        window._legacyStart = [];

        window.Core = {
          Modules: {
            start: function(moduleName) {
              window._legacyStart.push(moduleName);
            }
          }
        };

        window._legacyAdvManager = {
          add: [],

          addScriptImmediately: []
        };

        AdvManager = {
          add: function() {
            window._legacyAdvManager.add.push(
              Array.prototype.slice.call(arguments)
            );
          },

          addScriptImmediately: function() {
            window._legacyAdvManager.addScriptImmediately.push(
              Array.prototype.slice.call(arguments)
            );
          }
        };

        jQuery = {};
      })();

in there

if (hasEski && mobile) {
 info.position === 'MobileReady' && document.write('<link rel="Stylesheet" type="text/css" href="' + path + '" \/>');
 } else {
 document.write('<link rel="Stylesheet" type="text/css" href="' + path + '" \/>');
 }

hasEski is false, but it seems false in chrome too.

hmmm…

@karlcow
Copy link
Member

karlcow commented Mar 12, 2019

There's also #11410 which seems similar.

@karlcow
Copy link
Member

karlcow commented Mar 12, 2019

This script is still not being written in the DOM.

<script
      src="https://www.ozon.ru/eskimobi/mobi.js"
      id="main-executable"
      class="mobify"
    ></script>

@karlcow
Copy link
Member

karlcow commented Mar 18, 2019

And this one is not being written either.

<script src="https://www.ozon.ru/eskimobi/eski.mobi.min.js" id="mobify-js" class="mobify"></script>

ok I know where it fails but I don't know why, apart that the UA sniffing has an impact.

when the UA is Firefox, it nevers gets into the setTimeout in

        if (s && s[3]) {
          if (!+s[3]) return;
        } else if (!t()) return;
        i.write(
          '<div id="eski-overlay" style="font-family:Helvetica-Light,Helvetica,Arial,sans-serif;font-weight:light;font-size:300%;line-height:100%;position:absolute;top:42%;left:0;right:0;text-align:center;color: #999;"><img src="https://ozon-st.cdn.ngenix.net/mobileapp/static/five-dots.svg"></div><plaintext style="display:none">'
        ),
          setTimeout(function() {

s is null so both Chrome and Firefox get into the else if.

t() is an anonymous function which is

and even simplifying it doesn't give me the right result.

 "(function() {
          var e = navigator.userAgent || navigator.vendor || window.opera,
            i = !1;
                      return (

            /mobi/i.test(e) && (i = !0),
            (/android(.*)firefox/i.test(
              e
            ) ||
              Math.min(screen.width, screen.height) > 767) &&
              (i = !1),
            i
          );
        })"

The function returns false and the i.write doesn't get executed. If I force it to return true this is working.

ok this is it

        function() {
          var e = navigator.userAgent || navigator.vendor || window.opera,
            i = !1;
          return (
            /mobi|phone|ipod|nokia/i.test(e) && (i = !0),
            (/msie|windows|media\scenter|opera\smini|ipad|android\s3|android\s2|iphone\sos\s(4|5|6)|ipad\sos\s(4|5|6)|fennec|android(.*)firefox/i.test(
              e
            ) ||
              Math.min(screen.width, screen.height) > 767) &&
              (i = !1),
            i
          );
        },

This returns false with Firefox UA and returns true with Chrome UA.

Ah! Gotcha! doh! so much time for something obvious…

            /mobi|phone|ipod|nokia/i.test(e) && (i = !0),

this returns true. No issue there.

but THIS returns false for Chrome

            (/msie|windows|media\scenter|opera\smini|ipad|android\s3|android\s2|iphone\sos\s(4|5|6)|ipad\sos\s(4|5|6)|fennec|android(.*)firefox/i.test(e)

I was trying to guess the opposite, then I realized that by decomposing and removing what would match Chrome and what would match Firefox, it would return false.

OK So we need to contact the site so they remove:

fennec|android(.*)firefox

OR

if we ask @denschub to add a site patching.

@karlcow karlcow added type-uaoverride Require a UA override for working and removed status-needsinfo-karlcow ping @karlcow labels Mar 18, 2019
@karlcow karlcow modified the milestones: needsdiagnosis, needscontact Mar 18, 2019
@karlcow karlcow removed their assignment Mar 18, 2019
@miketaylr miketaylr added the engine-gecko The browser uses the Gecko rendering engine label Apr 30, 2019
@adamopenweb adamopenweb added the severity-critical The site or core functionality is unusable, or you would probably open another browser to use it. label May 3, 2019
@softvision-sergiulogigan

This has been fixed now.

image

Tested with:
Browser / Version: Firefox Nightly Mobile 68.3a1 (2019-10-29), Firefox Preview Nightly 191029 (🦎: 71.0a1-20191025095546)
Operating System: Samsung Galaxy S8 (Android 9) - 1440 x 2960 pixels, 18.5:9 ratio (~570 ppi density)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
browser-firefox-mobile engine-gecko The browser uses the Gecko rendering engine severity-critical The site or core functionality is unusable, or you would probably open another browser to use it. type-uaoverride Require a UA override for working
Projects
None yet
Development

No branches or pull requests

7 participants