Trainspotting: Firefox 40

Trainspotting is a series of articles highlighting features in the lastest version of Firefox. A new version of Firefox is shipped every six weeks – we at Mozilla call this pattern “release trains.”

Firefox keeps on shippin' shippin' shippin' /
Into the future…
—Steve Miller Band, probably

Like a big ol’ jet airliner, a new version of Firefox has been cleared for takeoff! Let’s take a look at some of the snazzy new things in store for both users and developers.

For a full list of changes and additions, take a look at the Firefox 40 release notes.

Developer Tools

Find what you’re looking for in the Inspector, but don’t know where it is on the page? You can now scroll an element into view via the Markup View in the Inspector:

scroll-into-view

Sift through complex stylesheets more easily by filtering CSS rules:

You can now toggle how colors are represented by Shift+clicking on them in the Rules view:

color-rotate

The Web Console will now warn of code that is unreachable because it comes after a return statement:

unreachable

The Developer Tools have also gained a powerful new set of Performance analysis tools, which are demonstrated along with all the other Firefox 40 Developer Tools changes in this in-depth blog post.

Signed Add-ons

extension-warning

Malicious extensions are a growing problem in all browsers. Because Firefox Add-ons have tremendous power, there needs to be a better way to protect users from malicious code running wild. Starting in Firefox 42, all Firefox add-ons will be required to be signed in order to be able to be installed by end-users. In Firefox 40, users will be warned about un-signed extensions, but can opt to install them anyway. You can read more about why extension signing is needed, and also check out the overall plan for the roll-out of signed extensions.

Event offsetX and offsetY

Sometimes a good idea is a good idea, even if it takes 14 years! Firefox now supports the offsetX and offsetY properties for MouseEvents. This makes it much easier for code to track mouse events on an element within a page, without needing to know where in the page the element is. As always, perform capability checks to ensure that your code works across browsers:

el.addEventListener(function (e) {
  var x, y;
  if ('offsetX' in e) {
     x = e.offsetX;
     y = e.offsetY;
  } else {
    // addition needed for every offsetParent up the chain
    x = e.clientX + e.target.offsetLeft /* ... */;
    y = e.clientY + e.target.offsetTop /* ... */;
  }
  addGlitterMouseTrails(x, y);
}

But Wait, There’s More!

Every new version of Firefox has dozens of bug fixes and changes to make browsing and web development better- I’ve only touched upon a few. Finally, it’s well worth noting that 55 developers contributed their first code change to Firefox in this release, and 49 of them were brand new volunteers. Shipping would not be the same without these awesome contributions! Thank you!

For all the rest of the details, check out the Developer Release Notes or even the full list of fixed bugs. Happy Browsing!

About Potch

Potch is a Web Platform Advocate at Mozilla.

More articles by Potch…


8 comments

  1. Minh Nguyễn

    Technically, couldn’t that be `if (“offsetX” in e)`?

    August 11th, 2015 at 21:34

    1. Potch

      Yes! Not only that, but your syntax is more correct since it will not fail when offsetX is 0. Good catch. I’ll update the post.

      August 11th, 2015 at 22:43

  2. Jean Hominal

    The weblink for “Why extension signing is needed” is incorrect, because it is bracketed.

    August 12th, 2015 at 00:31

    1. Havi Hoffman [Editor]

      Thanks for noting. Now fixed.

      August 12th, 2015 at 07:24

  3. Albert

    Thanks for the updates!
    One of the links to a blog post seems to be wrong: “why extension signing is needed”.

    August 12th, 2015 at 04:37

  4. George8211

    As @Albert pointed out, the “why extension signing is needed” link is broken. It has parentheses around the href attribute when I open the Inspector.

    August 12th, 2015 at 04:46

    1. Havi Hoffman [Editor]

      @Albert & @George8211 — thanks for noting. Getting used to our Markdown plugin, it’s fixed now.

      August 12th, 2015 at 07:23

  5. roodi

    Target offsets for MouseEvent sound nice. They are in PointerEvent too, but unfortunately they are not in Touch Events spec for Touch. Are there any Touch implementations which have them anyway, or any other efforts towards consistency, preferrably on spec level (besides touch v pointer)?

    August 12th, 2015 at 06:24

Comments are closed for this article.