[go: up one dir, main page]

Side bar elements fail to render in browsers that lack `hasOwn` support

Summary

Browsers that lack Object.hasOwn support fail to render some elements in the sidebar (such as issue assignees).

The error is:

TypeError: Object.hasOwn is not a function
    at En.render (mount_sidebar.js:122)

Where mount_sidebar.js:122 is:

function mountAssigneesComponentDeprecated(mediator) {
  const el = document.getElementById('js-vue-sidebar-assignees');

  if (!el) return;

  const { id, iid, fullPath } = getSidebarOptions();
  const assigneeAvailabilityStatus = getSidebarAssigneeAvailabilityData();
  // eslint-disable-next-line no-new
  new Vue({
    el,
    name: 'SidebarAssigneesRoot',
    apolloProvider,
    components: {
      SidebarAssignees,
    },
    render: (createElement) =>
      createElement('sidebar-assignees', {
        props: {
          mediator,
          issuableIid: String(iid),
          projectPath: fullPath,
          field: el.dataset.field,
          signedIn: Object.hasOwn(el.dataset, 'signedIn'),
          issuableType:
            isInIssuePage() || isInIncidentPage() || isInDesignPage()
              ? IssuableType.Issue
              : IssuableType.MergeRequest,
          issuableId: id,
          assigneeAvailabilityStatus,
        },
      }),
  });
}

Steps to reproduce

Use a less-mainstream browser (I'm using the latest Qutebrowser v2.5.0)

Detailed browser version info:

qutebrowser v2.5.0
Git commit: 
Backend: QtWebEngine 5.15.9, based on Chromium 87.0.4280.144
Qt: 5.15.3

CPython: 3.10.4
PyQt: 5.15.6

sip: 6.5.1
colorama: 0.4.4
jinja2: 3.0.3
pygments: 2.11.2
yaml: 5.4.1
adblock: no
PyQt5.QtWebEngineWidgets: yes
PyQt5.QtWebEngine: 5.15.5
PyQt5.QtWebKitWidgets: no
pdf.js: no
sqlite: 3.37.2
QtNetwork SSL: OpenSSL 3.0.2 15 Mar 2022

Style: QFusionStyle
Platform plugin: xcb
OpenGL: Intel, 4.6 (Compatibility Profile) Mesa 22.0.1
Platform: Linux-5.15.0-33-generic-x86_64-with-glibc2.35, 64bit
Linux distribution: Ubuntu 22.04 LTS (ubuntu)
Frozen: False
Imported from /usr/lib/python3/dist-packages/qutebrowser
Using Python from /usr/bin/python3
Qt library executable path: /usr/lib/x86_64-linux-gnu/qt5/libexec, data path: /usr/share/qt5

What is the current bug behavior?

The sidebar fails to render correctly

What is the expected correct behavior?

I can see assignees

Relevant logs and/or screenshots

1654826639

Output of checks

This bug happens on GitLab.com

Possible fixes

Avoid using hasOwn - prefer hasOwnProperty:

  signedIn: el.dataset.hasOwnProperty('signedIn'),
Edited by Alex Kalderimis