Closed Bug 1520202 Opened 5 years ago Closed 5 years ago

Sometimes the browser can cache the wrong version of an asset

Categories

(bugzilla.mozilla.org :: General, defect)

Staging
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: ted, Assigned: dylan)

Details

Attachments

(1 file)

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) {

(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: nobody → dylan
Summary: ReferenceError: Mozilla is not defined on show_bug.cgi → Sometimes the browser can cache the wrong version of an asset
Attached 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
Closed: 5 years ago
Resolution: --- → FIXED
Status: NEW → RESOLVED
Closed: 5 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: