{"id":8086,"date":"2017-03-13T10:00:42","date_gmt":"2017-03-13T17:00:42","guid":{"rendered":"http:\/\/blog.mozilla.org\/addons\/?p=8086"},"modified":"2017-03-16T09:04:49","modified_gmt":"2017-03-16T16:04:49","slug":"webextensions-firefox-54","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/addons\/2017\/03\/13\/webextensions-firefox-54\/","title":{"rendered":"WebExtensions in Firefox 54"},"content":{"rendered":"<p><a href=\"https:\/\/wiki.mozilla.org\/RapidRelease\/Calendar#Future_branch_dates\">Firefox 54<\/a> landed in Developer Edition this week, so we have another update on<a href=\"https:\/\/wiki.mozilla.org\/WebExtensions\"> WebExtensions<\/a> for you. In addition to new APIs to help more developers port over to WebExtensions, we also announced a new <a href=\"https:\/\/blog.mozilla.org\/addons\/2017\/03\/09\/office-hours-support-transitioning-porting-webextensions\/\">Office Hours Support<\/a> schedule where developers can get more personalized help with the transition.<\/p>\n<h2>New APIs<\/h2>\n<p>A new API for <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1208596\">creating sidebars was implemented<\/a>. This allows you to place a local HTML file inside the sidebar. The API is similar to the one in Opera. If you specify the <code>sidebar_action<\/code> manifest key, Firefox will create a sidebar:<br \/>\n<a href=\"https:\/\/blog.mozilla.org\/addons\/files\/2017\/03\/Screenshot-2017-03-02-16.55.51.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-8089\" src=\"https:\/\/blog.mozilla.org\/addons\/files\/2017\/03\/Screenshot-2017-03-02-16.55.51.png\" alt=\"\" width=\"304\" height=\"184\" srcset=\"https:\/\/blog.mozilla.org\/addons\/files\/2017\/03\/Screenshot-2017-03-02-16.55.51.png 304w, https:\/\/blog.mozilla.org\/addons\/files\/2017\/03\/Screenshot-2017-03-02-16.55.51-252x153.png 252w\" sizes=\"(max-width: 304px) 100vw, 304px\" \/><\/a><\/p>\n<p>To allow <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1338727\">keyboard commands<\/a> to be sent to the sidebar, a new <code>_execute_sidebar_action<\/code> was added to the commands API which allows you trigger the showing of the sidebar.<\/p>\n<p>The ability to override the <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1234150\">about:newtab<\/a> with pages inside your extension was added to the <code>chrome_url_overrides<\/code> field in the manifest. Check out <a href=\"https:\/\/github.com\/mdn\/webextensions-examples\/tree\/master\/top-sites\">the example<\/a> that uses the <a href=\"https:\/\/developer.mozilla.org\/en-US\/Add-ons\/WebExtensions\/API\/topSites\">topSites<\/a> API to show the top sites you visit .<\/p>\n<p>The <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1312802\">privacy<\/a> API gives you the ability to flip certain Firefox preferences related to privacy. Although the preferences in Chrome and Firefox aren\u2019t a direct mapping, we\u2019ve mapped the Firefox preferences that makes sense to the APIs. Currently implemented are: <code>networkPredictionEnabled<\/code>, <code>webRTCIPHandlingPolicy<\/code> and <code>hyperlinkAuditingEnabled<\/code>.<\/p>\n<p>The <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1310427\">protocol_handler<\/a> API lets you easily map protocols to actions in your extension. For example: we use irccloud at Mozilla, so we can map <code>ircs:\/\/<\/code> links to irccloud by adding this into an extension:<\/p>\n<pre>  \"protocol_handlers\": [\r\n    {\r\n      \"protocol\": \"ircs\",\r\n      \"name\": \"IRC Mozilla Extension\",\r\n      \"uriTemplate\": \"https:\/\/irccloud.mozilla.com\/#!\/%s\"\r\n    }\r\n  ]\r\n<\/pre>\n<p>When a user clicks on an IRC link, it shows the application selector with the IRC Mozilla Extension visible:<\/p>\n<p><a href=\"https:\/\/blog.mozilla.org\/addons\/files\/2017\/03\/Screenshot-2017-03-03-14.47.52.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-8088 size-medium\" src=\"https:\/\/blog.mozilla.org\/addons\/files\/2017\/03\/Screenshot-2017-03-03-14.47.52-252x275.png\" alt=\"\" width=\"252\" height=\"275\" srcset=\"https:\/\/blog.mozilla.org\/addons\/files\/2017\/03\/Screenshot-2017-03-03-14.47.52-252x275.png 252w, https:\/\/blog.mozilla.org\/addons\/files\/2017\/03\/Screenshot-2017-03-03-14.47.52-600x655.png 600w, https:\/\/blog.mozilla.org\/addons\/files\/2017\/03\/Screenshot-2017-03-03-14.47.52.png 610w\" sizes=\"(max-width: 252px) 100vw, 252px\" \/><\/a><\/p>\n<p>This release also marks the landing of the first sets of <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1211859\">devtools APIs<\/a>. Quite a few APIs landed including: <code>inspectedWindow.reload()<\/code>, <code>inspectedWindow.eval()<\/code>, <code>inspectedWindow.tabId<\/code>, <code>network.onNavigated<\/code>, and <code>panels.create()<\/code>.<\/p>\n<p>Here\u2019s an example of the Redux DevTools extension running on Firefox:<br \/>\n<a href=\"https:\/\/blog.mozilla.org\/addons\/files\/2017\/03\/Screenshot-2017-03-03-15.07.57.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-8087\" src=\"https:\/\/blog.mozilla.org\/addons\/files\/2017\/03\/Screenshot-2017-03-03-15.07.57.png\" alt=\"\" width=\"800\" srcset=\"https:\/\/blog.mozilla.org\/addons\/files\/2017\/03\/Screenshot-2017-03-03-15.07.57.png 1225w, https:\/\/blog.mozilla.org\/addons\/files\/2017\/03\/Screenshot-2017-03-03-15.07.57-252x166.png 252w, https:\/\/blog.mozilla.org\/addons\/files\/2017\/03\/Screenshot-2017-03-03-15.07.57-768x505.png 768w, https:\/\/blog.mozilla.org\/addons\/files\/2017\/03\/Screenshot-2017-03-03-15.07.57-600x395.png 600w\" sizes=\"(max-width: 1225px) 100vw, 1225px\" \/><\/a><\/p>\n<h2>Backwards incompatible changes<\/h2>\n<p>The <code>webRequest<\/code> API will now require that <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1311815\">you&#8217;ve requested the appropriate hosts&#8217; permissions<\/a> before allowing you to perform <code>webRequest<\/code> operations on a URL. This will be a backwards-incompatible change for any extension which used <code>webRequest<\/code> but did not request the host permission.<\/p>\n<p><a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1333810\">Deletes<\/a> in <code>storage.sync<\/code> are now encrypted. This would be a breaking change for any extensions using <code>storage.sync<\/code> on Developer Edition.<\/p>\n<h2>API Changes<\/h2>\n<p>Some key events were completed in some popular APIs:<\/p>\n<ul>\n<li><a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1190689\"><code>webRequest.onBeforeRequest<\/code><\/a> is initiated before a server side redirect is about occur and <code>webRequest.onAuthRequired<\/code> is fired when an authentication failure occurs. These allow you to catch authentication requests from servers, such as proxy authentication.<\/li>\n<li><a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1190687\"><code>webNavigation.onCreatedNavigationTarget<\/code><\/a> event has been completed. This is fired when a new window or tab is created to be navigated to.<\/li>\n<li><a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1258360\"><code>runtime.onMessageExternal<\/code><\/a> event has been implemented. This is fired when a message is sent from another extension.<\/li>\n<\/ul>\n<p>Other notable bugs include:<\/p>\n<ul>\n<li>Geolocation <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1203233\">can now be used<\/a> in the background script of a WebExtension if the <code>geolocation<\/code> permission is specified.<\/li>\n<li>Content scripts now have <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1310318\">access to <code>canvas.drawWindow<\/code><\/a>.<\/li>\n<li>The <code>clipboardRead<\/code> <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1312260\">permission is now supported<\/a>.<\/li>\n<\/ul>\n<h2>Android<\/h2>\n<p>Notably in Firefox 54, <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1260548\">basic tabs<\/a> API support was landed for Android. The API support focuses on the parts of the API that make sense for Android, so some tab methods and events are deliberately not implemented.<\/p>\n<p>This is an important API in its own right, but other key APIs did not have good support without this. By landing this, Android WebExtensions got much better webNavigation and webRequest support. This gives us a clear path to getting ad blockers, the most common extension type on Android.<\/p>\n<h2>Contributors<\/h2>\n<p>A big thank you to our contributors <a href=\"https:\/\/bugzilla.mozilla.org\/user_profile?login=rob%40robwu.nl\">Rob Wu<\/a>, <a href=\"https:\/\/bugzilla.mozilla.org\/user_profile?login=tomica%40gmail.com\">Tomislav Jovanovic<\/a> and <a href=\"https:\/\/bugzilla.mozilla.org\/user_profile?login=tushar.saini1285%40gmail.com\">Tushar Saini<\/a> who helped out with this release.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Firefox 54 landed in Developer Edition this week, so we have another update on WebExtensions for you. In addition to new APIs to help more developers port over to WebExtensions, &hellip; <a class=\"go\" href=\"https:\/\/blog.mozilla.org\/addons\/2017\/03\/13\/webextensions-firefox-54\/\">Read more<\/a><\/p>\n","protected":false},"author":271,"featured_media":0,"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 in Firefox 54 - 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\/2017\/03\/13\/webextensions-firefox-54\/\" \/>\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\/2017\/03\/13\/webextensions-firefox-54\/\",\"url\":\"https:\/\/blog.mozilla.org\/addons\/2017\/03\/13\/webextensions-firefox-54\/\",\"name\":\"WebExtensions in Firefox 54 - Mozilla Add-ons Community Blog\",\"isPartOf\":{\"@id\":\"https:\/\/blog.mozilla.org\/addons\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/blog.mozilla.org\/addons\/2017\/03\/13\/webextensions-firefox-54\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/blog.mozilla.org\/addons\/2017\/03\/13\/webextensions-firefox-54\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/blog.mozilla.org\/addons\/files\/2017\/03\/Screenshot-2017-03-02-16.55.51.png\",\"datePublished\":\"2017-03-13T17:00:42+00:00\",\"dateModified\":\"2017-03-16T16:04:49+00:00\",\"author\":{\"@id\":\"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/7e1881db0e8a23a4a06695f8a0efd6b8\"},\"breadcrumb\":{\"@id\":\"https:\/\/blog.mozilla.org\/addons\/2017\/03\/13\/webextensions-firefox-54\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blog.mozilla.org\/addons\/2017\/03\/13\/webextensions-firefox-54\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/blog.mozilla.org\/addons\/2017\/03\/13\/webextensions-firefox-54\/#primaryimage\",\"url\":\"https:\/\/blog.mozilla.org\/addons\/files\/2017\/03\/Screenshot-2017-03-02-16.55.51.png\",\"contentUrl\":\"https:\/\/blog.mozilla.org\/addons\/files\/2017\/03\/Screenshot-2017-03-02-16.55.51.png\",\"width\":304,\"height\":184},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/blog.mozilla.org\/addons\/2017\/03\/13\/webextensions-firefox-54\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/blog.mozilla.org\/addons\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"WebExtensions in Firefox 54\"}]},{\"@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 in Firefox 54 - 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\/2017\/03\/13\/webextensions-firefox-54\/","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\/2017\/03\/13\/webextensions-firefox-54\/","url":"https:\/\/blog.mozilla.org\/addons\/2017\/03\/13\/webextensions-firefox-54\/","name":"WebExtensions in Firefox 54 - Mozilla Add-ons Community Blog","isPartOf":{"@id":"https:\/\/blog.mozilla.org\/addons\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blog.mozilla.org\/addons\/2017\/03\/13\/webextensions-firefox-54\/#primaryimage"},"image":{"@id":"https:\/\/blog.mozilla.org\/addons\/2017\/03\/13\/webextensions-firefox-54\/#primaryimage"},"thumbnailUrl":"https:\/\/blog.mozilla.org\/addons\/files\/2017\/03\/Screenshot-2017-03-02-16.55.51.png","datePublished":"2017-03-13T17:00:42+00:00","dateModified":"2017-03-16T16:04:49+00:00","author":{"@id":"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/7e1881db0e8a23a4a06695f8a0efd6b8"},"breadcrumb":{"@id":"https:\/\/blog.mozilla.org\/addons\/2017\/03\/13\/webextensions-firefox-54\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.mozilla.org\/addons\/2017\/03\/13\/webextensions-firefox-54\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blog.mozilla.org\/addons\/2017\/03\/13\/webextensions-firefox-54\/#primaryimage","url":"https:\/\/blog.mozilla.org\/addons\/files\/2017\/03\/Screenshot-2017-03-02-16.55.51.png","contentUrl":"https:\/\/blog.mozilla.org\/addons\/files\/2017\/03\/Screenshot-2017-03-02-16.55.51.png","width":304,"height":184},{"@type":"BreadcrumbList","@id":"https:\/\/blog.mozilla.org\/addons\/2017\/03\/13\/webextensions-firefox-54\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blog.mozilla.org\/addons\/"},{"@type":"ListItem","position":2,"name":"WebExtensions in Firefox 54"}]},{"@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\/8086"}],"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=8086"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/posts\/8086\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/media?parent=8086"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/categories?post=8086"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/tags?post=8086"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}