{"id":1604,"date":"2010-06-14T17:42:13","date_gmt":"2010-06-15T00:42:13","guid":{"rendered":"http:\/\/blog.mozilla.org\/addons\/?p=1604"},"modified":"2010-06-14T17:42:13","modified_gmt":"2010-06-15T00:42:13","slug":"multiple-breaking-changes-are-coming-for-components-in-extensions","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/addons\/2010\/06\/14\/multiple-breaking-changes-are-coming-for-components-in-extensions\/","title":{"rendered":"Multiple breaking changes are coming for components in extensions"},"content":{"rendered":"<div>\n<p>Are you an extension or application developer? Have you  written any XPCOM components, JS, binary or otherwise? If not you can  probably ignore the rest of this post, unless you are interested anyway.<\/p>\n<p>If you do then you might be interested to hear that your components  are probably going to break in an upcoming Firefox nightly, maybe as  early as next week. I\u2019m going to blog specific examples on the changes  you need to make once  we have better documentation up and builds to  test against, for now it  is just important for you to know that the  changes are coming.<\/p>\n<h3>Changing XPCOM component registration<\/h3>\n<p>One of the things we are doing is changing how XPCOM components are  registered. Previously during registration we would load all binary and  JS component files and call them asking them to register themselves. If  you used XPCOMUtils.jsm then some of that ugliness will have been hidden  from you. The future though will be <a href=\"https:\/\/wiki.mozilla.org\/XPCOM\/Bootstrap#Registration\">registration using manifest files<\/a>,  similar to how chrome is registered (in the same files in fact). Every  single JS or binary component will need fixes to support this. The  amount of work to do is fairly trivial per component and it is possible  to support both old and new styles of registration in the same component  but until that work is done your components will not work.<\/p>\n<h3>Starting extension components later<\/h3>\n<p>Currently there are a bunch of <a href=\"https:\/\/developer.mozilla.org\/en\/Observer_Notifications\">different notifications<\/a> that components can listen for to perform actions during startup.  Commonly xpcom-startup, app-startup and profile-after-change have been  the most common. The latter is generally the best to use since this is  one of the earliest notifications that occurs after the profile folder  (and hence preferences and other services) is available.<\/p>\n<p>The news is that once we make our changes components from extensions  will no longer be able to register for and receive the xpcom-startup or  app-startup notifications at all. profile-after-change will be the first  notification that components can be loaded by.<\/p>\n<p>Most of the reasons for loading on app-startup were either because  developers didn\u2019t know about profile-after-change or at one point it  used to be necessary to load for app-startup just to be able to register  for profile-after-change in the observer service. That is no longer the  case as you can register for it in the category manager exactly as you  can for app-startup.<\/p>\n<h3>Why?<\/h3>\n<p>You might well ask why we are making all these changes.<\/p>\n<p>Currently whenever we detect a potential change in the set of usable  components (meaning either the application version has changed or an  extension has been added\/removed\/enabled\/disabled) we must throw away  existing component registrations and then perform what has become known  as the EM restart where the application is restarted during its startup  (in theory invisibly to the user) to make sure that any component that  weren\u2019t meant to be loaded are unloaded and to re-register everything  and load any new components that need it.<\/p>\n<p>Registration is itself a costly process since every component must be  loaded and executed when really many if not most of them do not need to  be loaded during startup. In the E10S world there are even more  problems. Content processes must either register all components during  every startup or somehow share a component cache with the chrome  process.<\/p>\n<p>The new registration model allows us to do away with the EM restart.  On startup rather than relying on a potentially stale component cache we  will read the registrations for the main application out of a manifest  file. This will give us enough of XPCOM to then be able to load the  extension manager and do any necessary work to install\/uninstall\/update  any extensions after which we can simply load the component  registrations for those out of the manifest file. Startup then just  proceeds as normal, no restart is necessary since nothing from  extensions can have been loaded when it shouldn\u2019t.<\/p>\n<p>E10S content processes can just read the component registrations  during startup, since they are in simple manifest files this will go a  lot faster<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Are you an extension or application developer? Have you written any XPCOM components, JS, binary or otherwise? If not you can probably ignore the rest of this post, unless you &hellip; <a class=\"go\" href=\"https:\/\/blog.mozilla.org\/addons\/2010\/06\/14\/multiple-breaking-changes-are-coming-for-components-in-extensions\/\">Read more<\/a><\/p>\n","protected":false},"author":123,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[388,44],"tags":[278877,278873],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Multiple breaking changes are coming for components in extensions - 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\/2010\/06\/14\/multiple-breaking-changes-are-coming-for-components-in-extensions\/\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Dave Townsend\" \/>\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\/2010\/06\/14\/multiple-breaking-changes-are-coming-for-components-in-extensions\/\",\"url\":\"https:\/\/blog.mozilla.org\/addons\/2010\/06\/14\/multiple-breaking-changes-are-coming-for-components-in-extensions\/\",\"name\":\"Multiple breaking changes are coming for components in extensions - Mozilla Add-ons Community Blog\",\"isPartOf\":{\"@id\":\"https:\/\/blog.mozilla.org\/addons\/#website\"},\"datePublished\":\"2010-06-15T00:42:13+00:00\",\"dateModified\":\"2010-06-15T00:42:13+00:00\",\"author\":{\"@id\":\"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/9d53950fffd8370f827fd45a3f4adcd5\"},\"breadcrumb\":{\"@id\":\"https:\/\/blog.mozilla.org\/addons\/2010\/06\/14\/multiple-breaking-changes-are-coming-for-components-in-extensions\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blog.mozilla.org\/addons\/2010\/06\/14\/multiple-breaking-changes-are-coming-for-components-in-extensions\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/blog.mozilla.org\/addons\/2010\/06\/14\/multiple-breaking-changes-are-coming-for-components-in-extensions\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/blog.mozilla.org\/addons\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Multiple breaking changes are coming for components in extensions\"}]},{\"@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\/9d53950fffd8370f827fd45a3f4adcd5\",\"name\":\"Dave Townsend\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/8f56e46f0120d9477f8f320991a2196a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/8f56e46f0120d9477f8f320991a2196a?s=96&d=mm&r=g\",\"caption\":\"Dave Townsend\"},\"description\":\"I'm a senior Firefox developer who has spent most of his working life helping to make Firefox extensible. I currently manage the SDK team of the developer tools group.\",\"sameAs\":[\"http:\/\/www.oxymoronical.com\"],\"url\":\"https:\/\/blog.mozilla.org\/addons\/author\/dtownsendmozillacom\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Multiple breaking changes are coming for components in extensions - 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\/2010\/06\/14\/multiple-breaking-changes-are-coming-for-components-in-extensions\/","twitter_misc":{"Written by":"Dave Townsend","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/blog.mozilla.org\/addons\/2010\/06\/14\/multiple-breaking-changes-are-coming-for-components-in-extensions\/","url":"https:\/\/blog.mozilla.org\/addons\/2010\/06\/14\/multiple-breaking-changes-are-coming-for-components-in-extensions\/","name":"Multiple breaking changes are coming for components in extensions - Mozilla Add-ons Community Blog","isPartOf":{"@id":"https:\/\/blog.mozilla.org\/addons\/#website"},"datePublished":"2010-06-15T00:42:13+00:00","dateModified":"2010-06-15T00:42:13+00:00","author":{"@id":"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/9d53950fffd8370f827fd45a3f4adcd5"},"breadcrumb":{"@id":"https:\/\/blog.mozilla.org\/addons\/2010\/06\/14\/multiple-breaking-changes-are-coming-for-components-in-extensions\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.mozilla.org\/addons\/2010\/06\/14\/multiple-breaking-changes-are-coming-for-components-in-extensions\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/blog.mozilla.org\/addons\/2010\/06\/14\/multiple-breaking-changes-are-coming-for-components-in-extensions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blog.mozilla.org\/addons\/"},{"@type":"ListItem","position":2,"name":"Multiple breaking changes are coming for components in extensions"}]},{"@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\/9d53950fffd8370f827fd45a3f4adcd5","name":"Dave Townsend","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/8f56e46f0120d9477f8f320991a2196a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8f56e46f0120d9477f8f320991a2196a?s=96&d=mm&r=g","caption":"Dave Townsend"},"description":"I'm a senior Firefox developer who has spent most of his working life helping to make Firefox extensible. I currently manage the SDK team of the developer tools group.","sameAs":["http:\/\/www.oxymoronical.com"],"url":"https:\/\/blog.mozilla.org\/addons\/author\/dtownsendmozillacom\/"}]}},"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/posts\/1604"}],"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\/123"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/comments?post=1604"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/posts\/1604\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/media?parent=1604"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/categories?post=1604"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/tags?post=1604"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}