Firefox 41 for developers
=========================

To test the latest developer features of Firefox, install Firefox Developer Edition Firefox 41 was released on September 22, 2015. This article lists key changes that are useful not only for web developers, but also Firefox and Gecko developers as well as add-on developers.Changes for Web developers
--------------------------

### 开发工具

Highlights:

* Take a screenshot of a DOM node
* Copy as HAR/save as HAR
* "Add Rule" button in the Rules view
* View source in a tab (en-US) (Disabled by default)
* More options to copy CSS rules
* Copy image as data: URI in the Rules view
* Added command to GCLI to display CSP info

All devtools bugs fixed between Firefox 40 and Firefox 41: note that many of these bugs, especially those relating to the performance tools, were uplifted to Firefox 40.

### CSS

* Support for laying out vertical scripts has been activated by default (Firefox bug 1138384). That means that the following CSS properties are now available:
    + Choosing the direction of writing: `writing-mode`.
    + Controlling orientation of characters: `text-orientation`.
    + Direction-independent equivalents of `width` and `height`: `block-size` and `inline-size`.
    + Direction-independent equivalents of `min-width` and `min-height`: `min-block-size` and `min-inline-size`.
    + Direction-independent equivalents of `max-width` and `max-height`: `max-block-size` (en-US) and `max-block-size` (en-US).
    + Direction-independent equivalents of `margin-top`, `margin-right`, `margin-bottom` and `margin-left`: `margin-block-start`, `margin-block-end`, `margin-inline-start` and `margin-inline-end`.
    + Direction-independent equivalents of `padding-top`, `padding-right`, `padding-bottom` and `padding-left`: `padding-block-start`, `padding-block-end`, `padding-inline-start` and `padding-inline-end`.
    + Direction-independent equivalents of `border-top`, `border-right`, `border-bottom` and `border-left` and their longhands for width, style and color: `border-block-start`, `border-block-start-width`, `border-block-start-style`, `border-block-start-color`, `border-block-end`, `border-block-end-width`, `border-block-end-style`, `border-block-end-color`, `border-inline-start`, `border-inline-start-width`, `border-inline-start-style`, `border-inline-start-color`, `border-inline-end`, `border-inline-end-width`, `border-inline-end-style` and `border-inline-end-color`.
    + Direction-independent equivalents of `top`, `right`, `bottom` and `left`: `offset-block-start` (en-US), `offset-block-end` (en-US), `offset-inline-start` (en-US) and `offset-inline-end` (en-US).
* Support the `transform-origin` property in SVG and implement the `transform-box` property (Firefox bug 923193).
### HTML

* `<a>` 没有 `href` 属性，并且不再被分类为交互内容。点击 `<label>` 将会激活标签内容 (Firefox bug 1167816).
* SVG 图标现在支持站点图标 (偏爱图标和快捷方式图标)(Firefox bug 366324).
* The `crossorigin` attribute is now supported for <link rel='preconnect'> (Firefox bug 1174152).
* The picture element does not react to resize/viewport changes (Firefox bug 1135812).
### JavaScript

* `Date.prototype` (en-US)现在是一个普通对象，不再是一个 `Date` 实例 (Firefox bug 861219).
* `Date.prototype.toString` 现在是一般方法 (Firefox bug 861219).
* `Symbol.species`被增加到 (Firefox bug 1131043).
* `Map[@@species]` 和`Set[@@species]` 获取已经被增加 (Firefox bug 1131043).
* 非标准 let expression 支持已经被废弃 (Firefox bug 1023609).
* Destructured parameters with default value assignment 现在已经被支持 (Firefox bug 1018628).
* Per ES2015, 方法定义 需要尖括号。从现在开始语法没有尖括号将会失败 (Firefox bug 1150855).
* 方法定义 (除了生成方法) 已经不再可构造 (Firefox bug 1059908 和Firefox bug 1166950).
* As part of ES2015 specification compliance, parenthesized destructuring patterns, like `([a, b]) = [1, 2]` or `({a, b}) = { a: 1, b: 2 }`, are now considered invalid and will throw a `SyntaxError`. See Jeff Walden's blog post for more details.
* The `new.target` syntax has been added (Firefox bug 1141865).
### Interfaces/APIs/DOM

* 剪切、复制和粘贴命令处理已经被重新编码，并且现在允许 JS 编程实现网页内容复制和剪切。
    + 使用 `'paste'`名利作为参数，`Document.queryCommandSupported()`现在会返回 false 如果不充分的权限被执行 (Firefox bug 1161721).
    + 使用`'cut'` 或 `'copy'` 命令作为参数，`Document.queryCommandSupported()` 现在返回`true` 如果调用的上下文中包括用户发起的或特权代码 (Firefox bug 1162952).
    + 使用 `'cut'` 或`'copy'` 命令作为参数，`Document.execCommand()` 将会执行，但是仅仅在用户发起的或特权代码的上下文下 (Firefox bug 1012662).

#### Events

* 非标准的`CloseEvent.initCloseEvent()` (en-US) 方法和创建 `CloseEvent` 使用 `Event.createEvent('CloseEvent')` (en-US) 方法已经被移除。相反可以使用标准的构造器`CloseEvent()` (en-US) . (Firefox bug 1161950).
* On Desktop, `PointerEvent` is now activated by default in Nightly; it is not activated in Developer Edition, Beta or Release and won't be for at least some versions (Firefox bug 1166347).
* The unprefixed version of `MouseEvent.movementX` and `MouseEvent.movementY` have been added; the prefixed versions are deprecated and will be removed at some point in the future (Firefox bug 1164981).

#### Web Crypto

* `SubtleCrypto.importKey()` 和`SubtleCrypto.exportKey()` 现在支持 `ECDH` keys (Firefox bug 1050175).

#### Canvas API

* `HTMLCanvasElement.captureStream()` and `CanvasCaptureMediaStream` have been added and allow to stream the display of a `<canvas>` in real-time (Firefox bug 1032848).
* `MediaStream.id` now returns the unique id of a stream (Firefox bug 1089798).
* The initial value of `CanvasRenderingContext2D.filter` is now correctly set to `none` (Firefox bug 1163124).

#### Service Workers

* Improvement to our experimental Service Worker (en-US) implementation:
    + `ServiceWorkerGlobalScope.skipWaiting()` has been implemented (Firefox bug 1131352).
    + `Clients.claim()` has been added (Firefox bug 1130684).
    + The other functional events of Service Workers have been made to inherit from `ExtendableEvent`, giving them access to the `waitUntil()` method (Firefox bug 1160527).
* The `CacheStorage` and `Cache` interfaces are now supported (Firefox bug 1110144).

#### WebGL

* The `failIfMajorPerformanceCaveat` WebGL context attribute has been added and can be set when creating a WebGL context with `HTMLCanvasElement.getContext()` to indicate if a context creation should fail if the system performance is low (Firefox bug 1164970).

#### WebRTC

* Firefox no longer offers a default STUN server to be used if none are specified when constructing a new `RTCPeerConnection`. You'll need to provide one in order to successfully establish a WebRTC connection.

#### Miscellaneous

* On OS X and Windows, `Navigator.onLine` (en-US) now changes regarding network connectivity (it always returned `true`, , unless "Work offline" mode was selected) before (Firefox bug 654579).
* `MessagePort` and `MessageChannel` now available in Web workers, and are enabled by default in all contexts (Firefox bug 952139) and (Firefox bug 911972).
* The User Timing API is now available in Web workers (Firefox bug 1155761).
* The Notifications API is now available in Web workers (Firefox bug 916893).
* `DOMRequest` and `DOMCursor` are now available in Web workers (Firefox bug 1167650).
* The CSS Font Loading API (en-US) has been completely implemented and is now enabled by default (Firefox bug 1149381).
* Shared workers can no longer be shared between private (i.e. browsing in a private window) and non-private documents (see Firefox bug 1177621).
* The `URLUtilsSearchParams.searchParams` property is now read-only (Firefox bug 1174731).
* The `URLUtils.hash` property no longer decodes URL fragment (Firefox bug 1093611).
### MathML

#### 新的默认、支持字体处理

数学公式需要特殊的字体。到目前为止，这些字体被硬编码在用户默认样式 `mathml.css` (使用`<math>` 标志设置字体组) 和偏好选项`font.mathfont-family` (为拉伸和大操作数设置支持字体). Firefox 41 引入一个能够自动设置<math>标志和相应偏好选项的内置`x-math` 语言 (例如`font.name.serif.x-math`). 用户默认样式现在将<math>标志字体设置为 serif 并且`font.mathfont-family` 被替换为 `font.name.serif.x-math`. 所有平台现在基本使用相同列表的支持字体， "Latin Modern Math" 是首选。在标准的 per-language 字体偏好菜单中，默认支持字体能够被设置。更多细节，请参照Firefox bug 947654 和 Firefox bug 1160456.

### SVG

* 站点图片 (偏爱图标，快捷方式图标) 现在支持 SVG(Firefox bug 366324)
### 音频/视频

* The `media.autoplay.enabled` preference now also apply to untrusted `HTMLMediaElement.play()` invocations too, that is calls from non-users activated scripts (Firefox bug 659285).
Networking
----------

* The `X-Content-Duration` header is no longer supported (Firefox bug 1160695).
* Draft versions of the HTTP/2 protocol are no more supported (Firefox bug 1132357).
Security
--------

* The CSP (en-US) 1.1 `manifest-src` directive (en-US) 已经被支持 (Firefox bug 1089255).
* Previous versions of Firefox incorrectly expected the Content Security Policy (en-US) referrer (en-US)directive's value `origin-when-cross-origin` to be spelled `origin-when-crossorigin`. This has been corrected to include the missing dash character.
Changes for add-on and Mozilla developers
-----------------------------------------

### XUL

*没有变化。*

### JavaScript code modules

*没有变化。*

### XPCOM

*没有变化。*

### 其他

* A new, internal, and chrome-context-only API to render the root widget of a window into a `<canvas>` has been added: `CanvasRenderingContext2D.drawWidgetAsOnScreen()`. This API uses the operating system to snapshot the widget on-screen. For more details see Firefox bug 1167477.
See also
--------

* Site Compatibility for Firefox 41
之前版本
----

* Firefox 40 for developers (en-US)
* Firefox 39 for developers (en-US)
* Firefox 38 for developers (en-US)
* Firefox 37 for developers (en-US)
* Firefox 36 for developers (en-US)
* Firefox 35 for developers (en-US)
* Firefox 34 for developers (en-US)
* Firefox 33 for developers
* Firefox 32 for developers
* Firefox 31 for developers
* Firefox 30 for developers (en-US)
* Firefox 29 for developers (en-US)
* Firefox 28 for developers (en-US)
* Firefox 27 for developers
* Firefox 26 for developers
* Firefox 25 for developers
* Firefox 24 for developers
* Firefox 23 for developers (en-US)
* Firefox 22 for developers
* Firefox 21 for developers
* Firefox 20 for developers
* Firefox 19 for developers
* Firefox 18 for developers
* Firefox 17 for developers (en-US)
* Firefox 16 for developers (en-US)
* Firefox 15 for developers (en-US)
* Firefox 14 for developers
* Firefox 13 for developers (en-US)
* Firefox 12 for developers (en-US)
* Firefox 11 for developers (en-US)
* Firefox 10 for developers (en-US)