• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mozilla / blurts-server / #13117

pending completion
#13117

push

circleci

Vinnl
Pretend HTMLElement.shadowRoot is always set

We generally only tend to access it after having called
this.attachShadow({ mode: 'open' }), and the error message about it
potentially being undefined at every location we access
this.shadowRoot is more noisy than helpful.

See also
https://github.com/mozilla/blurts-server/pull/2959#discussion_r1154023113
and
https://github.com/mozilla/blurts-server/pull/2959#discussion_r1154960095

282 of 1629 branches covered (17.31%)

Branch coverage included in aggregate %.

1 of 1 new or added line in 1 file covered. (100.0%)

959 of 4374 relevant lines covered (21.93%)

1.83 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/views/mainLayout.js
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/. */
4

5
import AppConstants from '../app-constants.js'
6
import { getMessage, getLocale } from '../utils/fluent.js'
7

8
const mainLayout = data => `
×
9
<!doctype html>
10
<html lang=${getLocale()}>
11
  <head>
12
    <title>${getMessage('brand-fx-monitor')}</title>
13
    <style>html {display: none;}</style>
14

15
    <meta charset='utf-8'>
16
    <meta name='viewport' content='width=320, initial-scale=1'>
17
    <meta name='description' content='${getMessage('meta-desc')}'>
18
    <meta name='twitter:card' content='summary_large_image'>
19
    <meta name='twitter:title' content='${getMessage('brand-fx-monitor')}'>
20
    <meta name='twitter:description' content='${getMessage('meta-desc')}'>
21
    <meta name='twitter:image' content='${AppConstants.SERVER_URL}/images/og-image.webp'>
22
    <meta property='og:title' content='${getMessage('brand-fx-monitor')}'>
23
    <meta property='og:description' content='${getMessage('meta-desc')}'>
24
    <meta property='og:site_name' content='${getMessage('brand-fx-monitor')}'>
25
    <meta property='og:type' content='website'>
26
    <meta property='og:url' content='${AppConstants.SERVER_URL}'>
27
    <meta property='og:image' content='${AppConstants.SERVER_URL}/images/og-image.webp'>
28

29
    <link rel='preload' href='/fonts/Metropolis-Bold.woff2' as='font' type='font/woff2' crossorigin>
30
    <link rel='preload' href='/fonts/Inter-Regular-latin.woff2' as='font' type='font/woff2' crossorigin>
31
    <link rel='stylesheet' href='/css/index.css' type='text/css'>
32
    <link rel='stylesheet' href='/css/partials/${data.partial.name}.css' type='text/css'>
33
    <link rel='icon' href='/images/favicon-16.webp' sizes='16x16'>
34
    <link rel='icon' href='/images/favicon-32.webp' sizes='32x32'>
35
    <link rel='icon' href='/images/favicon-48.webp' sizes='48x48'>
36
    <link rel='icon' href='/images/favicon-96.webp' sizes='96x96'>
37
    <link rel='icon' href='/images/favicon-144.webp' sizes='144x144'>
38
    <link rel='icon' href='/images/favicon-256.webp' sizes='256x256'>
39
    <link rel='apple-touch-icon' href='/images/apple-touch-icon.webp' sizes='180x180'>
40

41
    <script src='/js/index.js' type='module'></script>
42

43
    <!-- Google tag (gtag.js) -->
44
    <script nonce='${data.nonce}'>
45
      (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
46
      new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
47
      j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
48
      'https://www.googletagmanager.com/gtag/js?id='+i+dl;var n=d.querySelector('[nonce]');
49
      n&&j.setAttribute('nonce',n.nonce||n.getAttribute('nonce'));f.parentNode.insertBefore(j,f);
50
      })(window,document,'script','dataLayer','${AppConstants.GA4_MEASUREMENT_ID}');
51
      function gtag(){dataLayer.push(arguments);}
52
      ${AppConstants.GA4_DEBUG_MODE
×
53
        ? `gtag('config', '${AppConstants.GA4_MEASUREMENT_ID}', { 'debug_mode': true })`
54
        : ''}
55
      gtag('js', new Date());
56
      gtag('config', '${AppConstants.GA4_MEASUREMENT_ID}',
57
        { cookie_domain: window.location.hostname, cookie_flags: "SameSite=None;Secure" }
58
      );
59
      window.gtag = gtag
60
    </script>
61
    <!-- End Google tag (gtag.js) -->
62
  </head>
63
  <body>
64
    <header>
65
      <a href='/user/breaches'>
66
        <img class='monitor-logo' srcset='/images/monitor-logo-transparent.webp 213w, /images/monitor-logo-transparent@2x.webp 425w' width='213' height='33' alt='${getMessage('brand-fx-monitor')}'>
67
      </a>
68
      <div class='nav-wrapper'>
69
        <button class='nav-toggle'>
70
          <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 8' width='20'>
71
            <path d='M1 1h8M1 4h8M1 7h8' stroke='#000' stroke-width='1' stroke-linecap='round'/>
72
          </svg>
73
        </button>
74
        ${userMenu(data)}
75
      </div>
76
    </header>
77

78
    <nav class='site-nav'>
79
      <div class='pages-nav'>
80
        <a href='/user/breaches' class='nav-item ${data.partial.name === 'breaches' ? 'current' : ''}'>
×
81
          <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
82
            <path fill-rule="evenodd" clip-rule="evenodd" d="M10.5942 20.049C9.87439 21.3816 10.8394 22.9996 12.3539 22.9996H19.657C21.1692 22.9996 22.1344 21.3862 21.4193 20.0538L17.7796 13.2724C17.0264 11.8689 15.0148 11.8662 14.2577 13.2676L10.5942 20.049Z" fill="white" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
83
            <path fill-rule="evenodd" clip-rule="evenodd" d="M16 21C16.5523 21 17 20.5523 17 20C17 19.4477 16.5523 19 16 19C15.4477 19 15 19.4477 15 20C15 20.5523 15.4477 21 16 21Z" fill="currentcolor"/>
84
            <path d="M16 17V16" stroke="currentcolor" stroke-width="2" stroke-linecap="round"/>
85
            <path d="M7 22H5C3.89543 22 3 21.1046 3 20V11C3 9.89543 3.89543 9 5 9H19C20.1046 9 21 9.89543 21 11V13" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
86
            <path d="M7 9V7C7 4.23858 9.23858 2 12 2C14.7614 2 17 4.23858 17 7V9" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
87
          </svg>
88
          ${getMessage('site-nav-breaches-link')}
89
        </a>
90
      </div>
91
      <div class='meta-nav'>
92
        <a href='/user/settings' class='nav-item ${data.partial.name === 'settings' ? 'current' : ''}'>
×
93
          ${getMessage('site-nav-settings-link')}
94
        </a>
95
        <a target="_blank" href='https://support.mozilla.org/kb/firefox-monitor' class='nav-item'>
96
          ${getMessage('site-nav-help-link')}
97
        </a>
98
      </div>
99
      <div class='callouts'>
100
        <p>${getMessage('site-nav-ad-callout')}</p>
101
        <a href='https://relay.firefox.com/?utm_medium=mozilla-websites&utm_source=monitor&utm_campaign=&utm_content=nav-bar-global' target='_blank'><img src='/images/logo-relay.svg' width='416' height='92' alt='${getMessage('brand-relay')}'></a>
102
        <a href='https://www.mozilla.org/products/vpn?utm_medium=mozilla-websites&utm_source=monitor&utm_campaign=&utm_content=nav-bar-global' target='_blank'><img src='/images/logo-vpn.svg' width='232' height='48' alt='${getMessage('brand-mozilla-vpn')}'></a>
103
      </div>
104
    </nav>
105

106
    <main data-partial='${data.partial.name}'>
107
      ${data.partial(data)}
108
    </main>
109
    <footer>
110
      <a href='https://www.mozilla.org' target='_blank'>
111
        <img src='/images/moz-logo-1color-white-rgb-01.svg' width='100' height='29' loading='lazy' alt='${getMessage('mozilla')}'>
112
      </a>
113
      <menu>
114
        <li><a href='/breaches'>${getMessage('footer-nav-all-breaches')}</a></li>
115
        <li><a href='https://support.mozilla.org/kb/firefox-monitor-faq' target='_blank'>FAQ</a></li>
116
        <li><a href='https://www.mozilla.org/privacy/firefox-monitor' target='_blank'>${getMessage('terms-and-privacy')}</a></li>
117
        <li><a href='https://github.com/mozilla/blurts-server' target='_blank'>${getMessage('github')}</a></li>
118
      </menu>
119
    </footer>
120
  </body>
121
</html>
122
`
123

124
const userMenu = data => `
×
125
<div class='user-menu-wrapper' tabindex='-1'>
126
  <button
127
    aria-expanded='false'
128
    aria-haspopup='true'
129
    class='user-menu-button'
130
    title='${getMessage('menu-button-title')}'
131
  >
132
    <img src='${data.fxaProfile?.avatar}' alt='${getMessage('menu-button-alt')}' />
133
  </button>
134
  <menu
135
    aria-label='${getMessage('menu-list-accessible-label')}'
136
    class='user-menu-container user-menu-popover'
137
    role='navigation'
138
    hidden
139
  >
140
    <li tabindex='1'>
141
      <a href='${AppConstants.FXA_SETTINGS_URL}' target='_blank' class='user-menu-header'>
142
        <b class='user-menu-email'>${data.fxaProfile?.email}</b>
143
        <div class='user-menu-subtitle'>
144
          ${getMessage('menu-item-fxa')}
145
          <img src='/images/icon-open-in.svg' />
146
        </div>
147
      </a>
148
    </li>
149
    <hr>
150
    <li>
151
      <a href='/user/settings' class='user-menu-link'>
152
        <img src='/images/icon-settings.svg' />
153
        ${getMessage('menu-item-settings')}
154
      </a>
155
    </li>
156
    <li>
157
      <a href='https://support.mozilla.org/kb/firefox-monitor' target='_blank' class='user-menu-link'>
158
        <img src='/images/icon-help.svg' />
159
        ${getMessage('menu-item-help')}
160
      </a>
161
    </li>
162
    <li>
163
      <a href='/user/logout' class='user-menu-link'>
164
        <img src='/images/icon-signout.svg' />
165
        ${getMessage('menu-item-logout')}
166
      </a>
167
    </li>
168
  </menu>
169
</div>
170
`
171

172
export { mainLayout }
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc