{"id":7933,"date":"2016-09-13T15:14:23","date_gmt":"2016-09-13T22:14:23","guid":{"rendered":"http:\/\/blog.mozilla.org\/addons\/?p=7933"},"modified":"2016-09-29T08:11:52","modified_gmt":"2016-09-29T15:11:52","slug":"webextensions-and-parity-with-chrome","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/addons\/2016\/09\/13\/webextensions-and-parity-with-chrome\/","title":{"rendered":"WebExtensions and parity with Chrome"},"content":{"rendered":"<p>A core strength of Firefox is its extensibility. You can do more to customize your browsing experience with add-ons than in any other browser. It\u2019s important to us, and our move to WebExtensions doesn\u2019t change that. One of the first goals of implementing WebExtensions, however, is reaching parity with Chrome\u2019s extension APIs.<\/p>\n<p>Parity allows developers to write add-ons that work in browsers that support the same core APIs with minimum fuss. It doesn\u2019t mean the APIs are identical, and I wanted to clarify the reasons why there are implementation differences between browsers.<\/p>\n<h3>Different browsers<\/h3>\n<p>Firefox and Chrome are different browsers, so some APIs from Chrome do not translate directly.<\/p>\n<p>One example is tab highlight. Chrome has this API because it has the concept of highlighted tabs, which Firefox does not. So instead of <code>browser.tabs.onHighlighted<\/code>, we fire this event on the active tab as <a href=\"https:\/\/developer.mozilla.org\/en-US\/Add-ons\/WebExtensions\/API\/tabs\/onHighlighted\">documented on MDN<\/a>. It&#8217;s not the same functionality as Chrome, but that response makes the most sense for Firefox.<\/p>\n<p>Another more complicated example is private browsing mode. The equivalent in Chrome is called incognito mode and extensions can support multiple modes: <code>spanning<\/code>, <code>split<\/code> or <code>not_allowed<\/code>. Currently we <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1277686\">throw an error<\/a> if we see a manifest that is not <code>spanning<\/code> as that is the mode that Firefox currently supports. We do this to alert extension authors testing out their extension that it won\u2019t operate the way they expect.<\/p>\n<h3>Less popular APIs<\/h3>\n<p>Some APIs are more popular than others. With limited people and time we\u2019ve had to focus on the APIs that we thought were the most important. At the beginning of this year we downloaded 10,000 publicly available versions of extensions off the Chrome store and examined the APIs called in those extensions. It\u2019s not a perfect sample, but it gave us a good idea.<\/p>\n<p>What we found was that there are some really popular APIs, like <code>tabs<\/code>, <code>windows<\/code>, and <code>runtime<\/code>, and there are some APIs that are less popular. One example is <a href=\"https:\/\/github.com\/andymckay\/arewewebextensionsyet.com\/blob\/master\/usage.csv#L298\">fontSettings.get<\/a>, which is used in 7 out of the 10,000 (0.07%) add-ons. Compare that to <a href=\"https:\/\/github.com\/andymckay\/arewewebextensionsyet.com\/blob\/master\/usage.csv#L298\">tabs.create<\/a>, which is used in 4,125 out of 10,000 (41.25%) add-ons.<\/p>\n<p>We haven\u2019t prioritized the development of the least-used APIs, but as always we welcome contributions from our community. To contribute to WebExtensions, check out our <a href=\"https:\/\/wiki.mozilla.org\/Add-ons\/Contribute#Develop_Web_Extensions_APIs\">contribution page<\/a>.<\/p>\n<h3>Deprecated APIs<\/h3>\n<p>There are some really popular APIs in extensions that are deprecated. It doesn\u2019t make sense for us to implement APIs that are already deprecated and are going to be removed. In these cases, developers will need to update their extensions to use the new APIs. When they do, they will work in the supported browsers.<\/p>\n<p>Some examples are in the extension API, which are mostly replaced by the <code>runtime<\/code> API. For example, use <a href=\"https:\/\/developer.mozilla.org\/en-US\/Add-ons\/WebExtensions\/API\/runtime\/sendMessage\"><code>runtime.sendMessage<\/code><\/a> instead of <code>extension.sendMessage<\/code>; use <a href=\"https:\/\/developer.mozilla.org\/en-US\/Add-ons\/WebExtensions\/API\/runtime\/onMessage\"><code>runtime.onMessage<\/code><\/a> instead of <code>extension.onRequest<\/code> and so on.<\/p>\n<h3>W3C<\/h3>\n<p>WebExtensions APIs will never completely mirror Chrome&#8217;s extension APIs, for the reasons outlined above. We are, however, already reaching a point where the majority of Chrome extensions work in Firefox.<\/p>\n<p>To make writing extensions for multiple browsers as easy as possible, Mozilla has been participating in a <a href=\"https:\/\/browserext.github.io\/\">W3C community group<\/a> for extension compatibility. Also participating in that group are representatives of Opera and Microsoft. We\u2019ll be sending a <a href=\"https:\/\/www.w3.org\/2016\/09\/TPAC\/\">representative to TPAC<\/a> this month to take part in discussions about this community group so that we can work towards a common browser standard for browser extensions.<\/p>\n<p><b>Update:<\/b> please check the MDN page on <a href=\"https:\/\/developer.mozilla.org\/en-US\/Add-ons\/WebExtensions\/Chrome_incompatibilities\">incompatibilities<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A core strength of Firefox is its extensibility. You can do more to customize your browsing experience with add-ons than in any other browser. It\u2019s important to us, and our &hellip; <a class=\"go\" href=\"https:\/\/blog.mozilla.org\/addons\/2016\/09\/13\/webextensions-and-parity-with-chrome\/\">Read more<\/a><\/p>\n","protected":false},"author":271,"featured_media":7871,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[44,278886],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>WebExtensions and parity with Chrome - Mozilla Add-ons Community Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.mozilla.org\/addons\/2016\/09\/13\/webextensions-and-parity-with-chrome\/\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Andy McKay\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blog.mozilla.org\/addons\/2016\/09\/13\/webextensions-and-parity-with-chrome\/\",\"url\":\"https:\/\/blog.mozilla.org\/addons\/2016\/09\/13\/webextensions-and-parity-with-chrome\/\",\"name\":\"WebExtensions and parity with Chrome - Mozilla Add-ons Community Blog\",\"isPartOf\":{\"@id\":\"https:\/\/blog.mozilla.org\/addons\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/blog.mozilla.org\/addons\/2016\/09\/13\/webextensions-and-parity-with-chrome\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/blog.mozilla.org\/addons\/2016\/09\/13\/webextensions-and-parity-with-chrome\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/blog.mozilla.org\/addons\/files\/2016\/07\/logo-addons_scaledSquareWhite.png\",\"datePublished\":\"2016-09-13T22:14:23+00:00\",\"dateModified\":\"2016-09-29T15:11:52+00:00\",\"author\":{\"@id\":\"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/7e1881db0e8a23a4a06695f8a0efd6b8\"},\"breadcrumb\":{\"@id\":\"https:\/\/blog.mozilla.org\/addons\/2016\/09\/13\/webextensions-and-parity-with-chrome\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blog.mozilla.org\/addons\/2016\/09\/13\/webextensions-and-parity-with-chrome\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/blog.mozilla.org\/addons\/2016\/09\/13\/webextensions-and-parity-with-chrome\/#primaryimage\",\"url\":\"https:\/\/blog.mozilla.org\/addons\/files\/2016\/07\/logo-addons_scaledSquareWhite.png\",\"contentUrl\":\"https:\/\/blog.mozilla.org\/addons\/files\/2016\/07\/logo-addons_scaledSquareWhite.png\",\"width\":180,\"height\":180,\"caption\":\"Addons Toolbox\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/blog.mozilla.org\/addons\/2016\/09\/13\/webextensions-and-parity-with-chrome\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/blog.mozilla.org\/addons\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"WebExtensions and parity with Chrome\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/blog.mozilla.org\/addons\/#website\",\"url\":\"https:\/\/blog.mozilla.org\/addons\/\",\"name\":\"Mozilla Add-ons Community Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/blog.mozilla.org\/addons\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/7e1881db0e8a23a4a06695f8a0efd6b8\",\"name\":\"Andy McKay\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ad304e7a7d4f6fba05a81b10810fe6fd?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ad304e7a7d4f6fba05a81b10810fe6fd?s=96&d=mm&r=g\",\"caption\":\"Andy McKay\"},\"description\":\"Andy is an Engineering Manager at Mozilla. As a Canadian he tweets and blogs about curling, skiing, politics, maple syrup, bears and all things from the great white north.\",\"sameAs\":[\"http:\/\/mckay.pub\",\"https:\/\/x.com\/andymckay\"],\"url\":\"https:\/\/blog.mozilla.org\/addons\/author\/amckaymozilla-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"WebExtensions and parity with Chrome - Mozilla Add-ons Community Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.mozilla.org\/addons\/2016\/09\/13\/webextensions-and-parity-with-chrome\/","twitter_misc":{"Written by":"Andy McKay","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/blog.mozilla.org\/addons\/2016\/09\/13\/webextensions-and-parity-with-chrome\/","url":"https:\/\/blog.mozilla.org\/addons\/2016\/09\/13\/webextensions-and-parity-with-chrome\/","name":"WebExtensions and parity with Chrome - Mozilla Add-ons Community Blog","isPartOf":{"@id":"https:\/\/blog.mozilla.org\/addons\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blog.mozilla.org\/addons\/2016\/09\/13\/webextensions-and-parity-with-chrome\/#primaryimage"},"image":{"@id":"https:\/\/blog.mozilla.org\/addons\/2016\/09\/13\/webextensions-and-parity-with-chrome\/#primaryimage"},"thumbnailUrl":"https:\/\/blog.mozilla.org\/addons\/files\/2016\/07\/logo-addons_scaledSquareWhite.png","datePublished":"2016-09-13T22:14:23+00:00","dateModified":"2016-09-29T15:11:52+00:00","author":{"@id":"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/7e1881db0e8a23a4a06695f8a0efd6b8"},"breadcrumb":{"@id":"https:\/\/blog.mozilla.org\/addons\/2016\/09\/13\/webextensions-and-parity-with-chrome\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.mozilla.org\/addons\/2016\/09\/13\/webextensions-and-parity-with-chrome\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blog.mozilla.org\/addons\/2016\/09\/13\/webextensions-and-parity-with-chrome\/#primaryimage","url":"https:\/\/blog.mozilla.org\/addons\/files\/2016\/07\/logo-addons_scaledSquareWhite.png","contentUrl":"https:\/\/blog.mozilla.org\/addons\/files\/2016\/07\/logo-addons_scaledSquareWhite.png","width":180,"height":180,"caption":"Addons Toolbox"},{"@type":"BreadcrumbList","@id":"https:\/\/blog.mozilla.org\/addons\/2016\/09\/13\/webextensions-and-parity-with-chrome\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blog.mozilla.org\/addons\/"},{"@type":"ListItem","position":2,"name":"WebExtensions and parity with Chrome"}]},{"@type":"WebSite","@id":"https:\/\/blog.mozilla.org\/addons\/#website","url":"https:\/\/blog.mozilla.org\/addons\/","name":"Mozilla Add-ons Community Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.mozilla.org\/addons\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/7e1881db0e8a23a4a06695f8a0efd6b8","name":"Andy McKay","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/ad304e7a7d4f6fba05a81b10810fe6fd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ad304e7a7d4f6fba05a81b10810fe6fd?s=96&d=mm&r=g","caption":"Andy McKay"},"description":"Andy is an Engineering Manager at Mozilla. As a Canadian he tweets and blogs about curling, skiing, politics, maple syrup, bears and all things from the great white north.","sameAs":["http:\/\/mckay.pub","https:\/\/x.com\/andymckay"],"url":"https:\/\/blog.mozilla.org\/addons\/author\/amckaymozilla-com\/"}]}},"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/posts\/7933"}],"collection":[{"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/users\/271"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/comments?post=7933"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/posts\/7933\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/media\/7871"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/media?parent=7933"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/categories?post=7933"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/tags?post=7933"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}