Closed Bug 1651292 Opened 4 years ago Closed 4 years ago

Create intervention for www.jp.square-enix.com

Categories

(Web Compatibility :: Interventions, task, P1)

Unspecified
Android

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: karlcow, Assigned: karlcow)

References

()

Details

Attachments

(1 file)

There is user agent sniffing in this script which prevents to load the page at all.
But probably the override should happen only for the URI of this script.

https://www.jp.square-enix.com/music/sem/page/FF7R/ost/assets/js/main.js?v6

  preloadStart: function () {
    if (!sound.isPreloading) {
      sound.assetsDir = app.BASE_URL + sound.ASSETS_DIR,
      sound.isPreloading = !0,
      sound.preloadList = [
      ],
      sound.preloadCount = 0,
      window.AudioContext = window.AudioContext || window.webkitAudioContext;
      var e = navigator.userAgent;
      e.indexOf('Android') > 0 && e.match(/Chrome\/([\d]+)/).slice(1) >= 66 && (window.AudioContext = null),
      window.AudioContext ? (sound.context = new AudioContext, sound.previewContext = new AudioContext, sound.preloadList.length > 0 ? sound.getAudioBuffer()  : sound.checkPreload())  : sound.getLegacyAudio(),
      utils.getPageVisibillityEnabled() ? document.addEventListener('visibilitychange', function () {
        sound.documentHidden = document.hidden,
        sound.visibilityChangeHandler()
      }, !1)  : (window.onpagehide = function () {
        sound.documentHidden = !0,
        sound.visibilityChangeHandler()
      }, window.onpageshow = function () {
        sound.documentHidden = !1,
        sound.visibilityChangeHandler()
      })
    }
  },

faulty line is

      e.indexOf('Android') > 0 && e.match(/Chrome\/([\d]+)/).slice(1) >= 66 && (window.AudioContext = null),

see https://github.com/webcompat/web-bugs/issues/53018
it fails with Uncaught TypeError: can't access property "slice", e.match(...) is null

This user agent string is working.

Mozilla/5.0 (Android 10; Mobile; rv:79.0) Gecko/79.0 Firefox/79.0 Chrome/69
Priority: -- → P1
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: