{"id":2593,"date":"2011-06-07T17:14:01","date_gmt":"2011-06-08T00:14:01","guid":{"rendered":"http:\/\/blog.mozilla.org\/addons\/?p=2593"},"modified":"2011-06-17T10:41:10","modified_gmt":"2011-06-17T17:41:10","slug":"making-compatible-with-firefox-5-and-6","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/addons\/2011\/06\/07\/making-compatible-with-firefox-5-and-6\/","title":{"rendered":"Making your add-ons compatible with Firefox 5 and 6"},"content":{"rendered":"<p><strong>Update:<\/strong> moved bullet point about <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=656331\">Bug 656331<\/a> from Firefox 6 section to Firefox 5. Thanks, Nils!<\/p>\n<p>The new rapid release schedule for Firefox is in effect, and you can already get preview versions of Firefox 5 and Firefox 6 in the <a href=\"http:\/\/www.mozilla.com\/en-US\/firefox\/channel\/\">Beta and Aurora channels<\/a>, respectively. Firefox 5 will most likely be released in a couple of weeks, and Firefox 6 should follow 6 weeks later.<\/p>\n<p>Because of the fast-paced schedule, these new releases are less problematic for add-on developers given that they include very few compatibility-breaking changes. This post covers all known add-on compatibility issues with Firefox 5 and 6. If you have run into other issues and don&#8217;t see them mentioned here or documented anywhere else, please let us know.<\/p>\n<p>We have already done an automatic compatibility upgrade to Firefox 5 for all add-ons that qualified for it, and we will do a similar upgrade for 6 sometime this week, maybe later today.<\/p>\n<p>How do we select which add-ons to upgrade? They need to be compatible with the previous Firefox version, they must not have binary components (since they usually need to be rebuilt) and they need to pass special compatibility tests that we create based on the known breaking changes, which are listed below.<\/p>\n<h3>Firefox 5<\/h3>\n<ul>\n<li>The value of <em>navigator.language<\/em> no longer reflects the language of the Firefox UI (<a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=55366\">Bug 55366<\/a>). To obtain the UI language you can use the <em>general.useragent.locale<\/em> preference instead.<\/li>\n<li>The default behavior of setTimeout and setInterval when no wait time is set has changed (<a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=610077\">Bug 610077<\/a>). If you set the timer to a very low value the actual wait time would be rounded to 10ms before. Now, that minimum has changed, and it depends on where the code is running.<\/li>\n<li>A number of words are now reserved in JavaScript, even when not in strict mode (<a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=637204\">Bug 637204<\/a>). The newly reserved words are <em>class<\/em>, <em>enum<\/em>, <em>export<\/em>, <em>extends<\/em>, <em>import<\/em> and <em>super<\/em>. You shouldn&#8217;t use these words anywhere in your code, even as object property names. Some add-ons that are affected by this might have been automatically upgraded to Firefox 5 compatibility, so please check your code and look for any errors during execution in Firefox 5.<\/li>\n<li>Instantiating nsICertOverrideService (and perhaps others) at startup can make Firefox unusable (<a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=650858\">Bug 650858<\/a>). We caught this one recently, and we&#8217;re still gauging its impact. The bug is only manifested if you try to instantiate a service before the load event. This is easy to avoid:<\/li>\n<\/ul>\n<p><strong>WRONG<\/strong><\/p>\n<pre>var comp = Components.classes[...].getService(...);\r\nvar MyObject = {\r\n  init: function() {},\r\n  ...\r\n}\r\nwindow.addEventListener(\"load\", function() { MyObject.init(); }, false);<strong><\/strong><\/pre>\n<p><strong>WRONG<\/strong><\/p>\n<pre>var MyObject = {\r\n  comp : Components.classes[...].getService(...),\r\n  init: function() {},\r\n  ...\r\n}\r\nwindow.addEventListener(\"load\", function() { MyObject.init(); }, false);<\/pre>\n<p><strong>RIGHT<\/strong><\/p>\n<pre>var MyObject = {\r\n  comp : null,\r\n  init: function() {\r\n    this.comp = Components.classes[...].getService(...);\r\n  },\r\n  ...\r\n}\r\nwindow.addEventListener(\"load\", function() { MyObject.init(); }, false);<\/pre>\n<p>Just don&#8217;t instantiate any components before the load event. Better yet, follow our <a href=\"https:\/\/developer.mozilla.org\/en\/Extensions\/Performance_best_practices_in_extensions\">performance best practices<\/a> and don&#8217;t instantiate anything until it&#8217;s needed.<\/p>\n<ul>\n<li>Mac OS SDK builds for the beta are missing (<a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=653971\">Bug 653971<\/a>). This affects you if you build binary components for Mac OS. There are several bugs involved in this, but they are being tracked in this bug. It should be fixed within a few days.<\/li>\n<li>XPCOM binary component registration no longer ignores Module::kVersion (<a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=656331\">Bug 656331<\/a>).<\/li>\n<li>More documented changes in <a href=\"https:\/\/developer.mozilla.org\/en\/Firefox_5_for_developers\">Firefox 5 for developers<\/a>.<\/li>\n<\/ul>\n<h3>Firefox 6<\/h3>\n<ul>\n<li>The <em>app.update.timer<\/em> preference was replaced by the <em>app.update.timerMinimumDelay<\/em> preference (<a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=614181\">Bug 614181<\/a>).<\/li>\n<li>A few interfaces (rarely) used in add-ons have been removed: IWeaveCrypto (<a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=651596\">Bug 651596<\/a>), nsIDOMDocumentTraversal (<a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=655514\">Bug 655514<\/a>) and nsIDOMDocumentRange (<a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=655513\">Bug 655513<\/a>).<\/li>\n<li><em>window.top<\/em> is now read-only (<a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=654137\">Bug 654137<\/a>). This affects your add-on if you use an undeclared variable called <em>top<\/em> in a chrome script.<\/li>\n<li>javascript: and data: URLs entered into the location bar no longer inherit the principal of the currently-loaded page (<a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=656433\">Bug 656433<\/a>). Maybe this won&#8217;t affect any add-ons, but there are many workarounds and odd pieces of code in the wild, so it&#8217;s better that you double check if you run any code using these types of URL.<\/li>\n<li>New Web Developer Sub-menu in the Tools menu (<a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=653221\">Bug 653221<\/a>). Because of all the new developer tools being included in Firefox, it was determined that it was best to group them in a sub-menu. This means that many overlays &#8211; those that rely on these menuitems being direct children of the Tools menu &#8211; will be affected. Your overlays will continue to work, but your items will most likely end up at the bottom of the menu instead of where you want them.<\/li>\n<li>Reordering of the History menu (<a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=625322\">Bug 625322<\/a>) and the Bookmarks menu (<a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=625325\">Bug 625325<\/a>). This may affect your add-on if you overlay or work on those menus.<\/li>\n<li>The <em>clearUserPref<\/em> method no longer throws if the pref doesn&#8217;t have a user value (<a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=487059\">Bug 487059<\/a>).<\/li>\n<li>Implement Site-Specific Privacy Preferences (<a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=573176\">Bug 573176<\/a>). This should only affect add-ons that rely on certain preferences (privacy, remember passwords, and others) being in the main preferences window.<\/li>\n<li>More documented changed in <a href=\"https:\/\/developer.mozilla.org\/en\/Firefox_6_for_developers\">Firefox 6 for developers<\/a>.<\/li>\n<\/ul>\n<p>Once again, if there&#8217;s anything missing in these lists, please let us know. Thank you!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Update: moved bullet point about Bug 656331 from Firefox 6 section to Firefox 5. Thanks, Nils! The new rapid release schedule for Firefox is in effect, and you can already &hellip; <a class=\"go\" href=\"https:\/\/blog.mozilla.org\/addons\/2011\/06\/07\/making-compatible-with-firefox-5-and-6\/\">Read more<\/a><\/p>\n","protected":false},"author":173,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[388,44,295],"tags":[805,278877,278873,278876,7107,7111],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Making your add-ons compatible with Firefox 5 and 6 - 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\/2011\/06\/07\/making-compatible-with-firefox-5-and-6\/\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jorge Villalobos\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blog.mozilla.org\/addons\/2011\/06\/07\/making-compatible-with-firefox-5-and-6\/\",\"url\":\"https:\/\/blog.mozilla.org\/addons\/2011\/06\/07\/making-compatible-with-firefox-5-and-6\/\",\"name\":\"Making your add-ons compatible with Firefox 5 and 6 - Mozilla Add-ons Community Blog\",\"isPartOf\":{\"@id\":\"https:\/\/blog.mozilla.org\/addons\/#website\"},\"datePublished\":\"2011-06-08T00:14:01+00:00\",\"dateModified\":\"2011-06-17T17:41:10+00:00\",\"author\":{\"@id\":\"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/a098261b4b5510d408ff31f492606925\"},\"breadcrumb\":{\"@id\":\"https:\/\/blog.mozilla.org\/addons\/2011\/06\/07\/making-compatible-with-firefox-5-and-6\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blog.mozilla.org\/addons\/2011\/06\/07\/making-compatible-with-firefox-5-and-6\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/blog.mozilla.org\/addons\/2011\/06\/07\/making-compatible-with-firefox-5-and-6\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/blog.mozilla.org\/addons\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Making your add-ons compatible with Firefox 5 and 6\"}]},{\"@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\/a098261b4b5510d408ff31f492606925\",\"name\":\"Jorge Villalobos\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6d1966118f16e4b99a6e3ad07883be33?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6d1966118f16e4b99a6e3ad07883be33?s=96&d=mm&r=g\",\"caption\":\"Jorge Villalobos\"},\"description\":\"Jorge is the Product Manager for addons.mozilla.org\",\"url\":\"https:\/\/blog.mozilla.org\/addons\/author\/jvillalobosmozilla-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Making your add-ons compatible with Firefox 5 and 6 - 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\/2011\/06\/07\/making-compatible-with-firefox-5-and-6\/","twitter_misc":{"Written by":"Jorge Villalobos","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/blog.mozilla.org\/addons\/2011\/06\/07\/making-compatible-with-firefox-5-and-6\/","url":"https:\/\/blog.mozilla.org\/addons\/2011\/06\/07\/making-compatible-with-firefox-5-and-6\/","name":"Making your add-ons compatible with Firefox 5 and 6 - Mozilla Add-ons Community Blog","isPartOf":{"@id":"https:\/\/blog.mozilla.org\/addons\/#website"},"datePublished":"2011-06-08T00:14:01+00:00","dateModified":"2011-06-17T17:41:10+00:00","author":{"@id":"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/a098261b4b5510d408ff31f492606925"},"breadcrumb":{"@id":"https:\/\/blog.mozilla.org\/addons\/2011\/06\/07\/making-compatible-with-firefox-5-and-6\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.mozilla.org\/addons\/2011\/06\/07\/making-compatible-with-firefox-5-and-6\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/blog.mozilla.org\/addons\/2011\/06\/07\/making-compatible-with-firefox-5-and-6\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blog.mozilla.org\/addons\/"},{"@type":"ListItem","position":2,"name":"Making your add-ons compatible with Firefox 5 and 6"}]},{"@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\/a098261b4b5510d408ff31f492606925","name":"Jorge Villalobos","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6d1966118f16e4b99a6e3ad07883be33?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6d1966118f16e4b99a6e3ad07883be33?s=96&d=mm&r=g","caption":"Jorge Villalobos"},"description":"Jorge is the Product Manager for addons.mozilla.org","url":"https:\/\/blog.mozilla.org\/addons\/author\/jvillalobosmozilla-com\/"}]}},"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/posts\/2593"}],"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\/173"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/comments?post=2593"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/posts\/2593\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/media?parent=2593"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/categories?post=2593"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/tags?post=2593"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}