Sometimes the browser can cache the wrong version of an asset

RESOLVED FIXED

Status

()

RESOLVED FIXED
2 months ago
2 months ago

People

(Reporter: ted, Assigned: dylan)

Tracking

Staging

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

I opened up devtools on a show_bug.cgi page to look at something and saw this error:

ReferenceError: Mozilla is not defined analytics.js:11:7
	<anonymous> https://bugzilla.mozilla.org/static/v20190108.1/extensions/GoogleAnalytics/web/js/analytics.js:11

The line in question is:

  if (typeof Mozilla.dntEnabled === 'function' && !Mozilla.dntEnabled() && meta.length) {
(Assignee)

Comment 1

2 months ago

(In reply to Ted Mielczarek [:ted] [:ted.mielczarek] from comment #0)

I opened up devtools on a show_bug.cgi page to look at something and saw this error:

ReferenceError: Mozilla is not defined analytics.js:11:7
	<anonymous> https://bugzilla.mozilla.org/static/v20190108.1/extensions/GoogleAnalytics/web/js/analytics.js:11

The line in question is:

  if (typeof Mozilla.dntEnabled === 'function' && !Mozilla.dntEnabled() && meta.length) {

It looks like you're a victim of the green/blue caching problem. Can you attempt a shift-reload?

The file should look like this:

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This Source Code Form is "Incompatible With Secondary Licenses", as
 * defined by the Mozilla Public License, v. 2.0. */

$(function() {
  var meta = $('meta[name="google-analytics"]');

  if (meta.length) {
    // Activate Google Analytics
    window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
    ga('create', meta.attr('content'), 'auto');
    ga('set', 'anonymizeIp', true);
    ga('set', 'location', meta.data('location'));
    ga('set', 'title', meta.data('title'));
    ga('set', 'transport', 'beacon');
    // Track page view
    ga('send', 'pageview');
  }
});

Yeah, analytics.js has been modified in v20190108.1 and Mozilla should not exist anymore.

(Assignee)

Updated

2 months ago
Assignee: nobody → dylan
Summary: ReferenceError: Mozilla is not defined on show_bug.cgi → Sometimes the browser can cache the wrong version of an asset
(Assignee)

Comment 3

2 months ago
Posted file GitHub Pull Request

So now when a request /static/v2 hits a server that is on v1, it will return the v1 asset but not set any caching headers.

Merged to master.

Status: NEW → RESOLVED
Last Resolved: 2 months ago
Resolution: --- → FIXED
(Assignee)

Updated

2 months ago
Status: NEW → RESOLVED
Last Resolved: 2 months ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.