Chrome 45 Beta: New ES2015 features, service worker improvements, and media controls
Monday, July 27, 2015
New ES2015 features
Over the past year Chrome has shipped a number of new JavaScript features defined in the ES2015 specification (formerly known as ES6), a major update to JavaScript that allows developers to write application logic that is easier to read, more powerful, and more memory efficient than ever before.
Chrome 45 includes a set of new ES2015 features including arrow functions, new methods on Array, new methods on TypedArray, and Object.assign().
Service worker improvements
Chrome 40 introduced support for service workers, enabling developers to build high performance sites that work offline. This release includes a number of improvements:
- Developers are now able to measure their service worker’s performance using the User Timing and Resource Timing APIs.
- Service workers used exclusively to send push notifications are now kept up-to-date correctly and developers can also use the new update method to manually trigger an update check.
- Sites can now use getRegistrations() to access all the service workers whose scope matches the current page.
Finally, in a breaking change, messages sent via Client.postMessage() now fire an event on navigator.serviceWorker instead of the window object.
Media controls in Android notifications
Playback controls for currently-playing audio are shown in the notification tray and on the lock screen
On Android, native apps can show media controls in a system notification when playing audio, making it easy for users to control audio while multitasking. Chrome 45 brings this capability to the web by showing a notification with media controls when audio is playing in web content. The controls will automatically show up when <audio> or <video> tags play audio longer than 5 seconds.
Other updates in this release
- Chrome’s implementation of the Push API has undergone several minor breaking changes to keep up to date with the evolving specification.
- The rotationAngle attribute of Touch objects is no longer prefixed, making it easier for sites to understand the geometry of the user's touch with cross-browser code.
- To improve scroll performance on pages with heavy mouse handlers or :hover styles, Chrome no longer sends mouse position updates when the user is scrolling with a trackpad or scrollwheel.
- Chrome now immediately prefetches all HTML imports referenced by a page instead of waiting for scripts included higher in the document to finish executing, improving performance.
- Sites can now include 3rd-party resources on their site with reduced security risk by using a hash to ensure the integrity of 3rd-parties resources.
- To reduce the risk of certain types of attack, the 'self' source defined by Content Security Policy now excludes blob and filesystem URLs.
- The logjam attack is fixed in this release by deprecating the use of keys smaller than 1024 bits in Diffie-Hellman key exchanges, which may require developers to update their server’s TLS configuration.
- To improve cross-browser compatibility and specification compliance, CSSUnknownRule and CSSKeyframesRule.insertRule() are now deprecated with the latter now replaced by CSSKeyframesRule.appendRule().
- Sites using SMIL will now trigger deprecation warnings in the console, encouraging them to migrate to CSS Animations and Web Animations.
- This release deprecates both multiple shadow roots and shadow-piercing deep selectors following a unanimous decision by browser vendors at the Web Components April 2015 meeting.
- The MediaStream attributes label and ended are now deprecated in favor of id and active, while the stop() method is deprecated in favor of MediaStreamTrack.stop().
Update: The User Timing and Resource Timing APIs are unfortunately not exposed to service workers in this release, but should be available in Chrome 46. As always, visit chromestatus.com/features for a complete overview of Chrome’s developer features, and circle +Google Chrome Developers for more frequent updates.
Posted by Andreas Rossberg, Software Engineer and ECMAScript Evangelizer