Talk:Extension Dependencies

From MozillaWiki
Jump to: navigation, search

Q. How to specify a required extension that applies to some but not all applications? (Where can the <em:requires> element appear?)

Example: a calendaring extension MYEXT extends either the Sunbird application or Lightning. Lightning is an extension to Thunderbird or Seamonkey (someday, but assume so for purpose of this example). So MYEXT can be installed in either Sunbird (without Lightning), or in Thunderbird with Lightning, or in Seamonkey with Lightning.

Alternative: One way to express this might be to say that the Thunderbird application and Seamonkey application each require Lightning.

(However, this seems strange because neither Thunderbird nor Seamonkey require Lightning in general. MYEXT requires Lightning on those apps.)

 <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
      xmlns:em="http://www.mozilla.org/2004/em-rdf#">
   <Description about="urn:mozilla:install-manifest">
     <em:id>myext@myorg.org</em:id>
     ...
     <em:targetApplication RDF:resource="rdf:#$sunbird"/>
     <em:targetApplication RDF:resource="rdf:#$thunderbird"/>
     <em:targetApplication RDF:resource="rdf:#$seamonkey"/>
   </Description>
 
   <Description RDF:about="rdf:#$sunbird">
     <em:id>{718e30fb-e89b-41dd-9da7-e25a45638b28}</em:id>
     <em:minVersion>...</em:minVersion>
     <em:maxVersion>...</em:maxVersion>
   </Description>
 
   <Description RDF:about="rdf:#$thunderbird">
     <em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
     <em:minVersion>...</em:minVersion>
     <em:maxVersion>...</em:maxVersion>
     <em:requires RDF:resource="rdf:#$lightning"/>
   </Description>
 
   <Description RDF:about="rdf:#$seamonkey">
     <em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id>
     <em:minVersion>...</em:minVersion>
     <em:maxVersion>...</em:maxVersion>
     <em:requires RDF:resource="rdf:#$lightning"/>
   </Description>
 
   <Description RDF:about="rdf:#$lightning"/>
     <em:id>{e2fda1a4-762b-4020-b5ad-a41df1933103}</em:id>
     <em:name>Lightning</em:name>
     <em:minVersion>...</em:minVersion>
     <em:maxVersion>...</em:maxVersion>
   </Description>
 </RDF>

(See next question for an alternative that applies only to extensions that extend an extension without regard to base application.)


Q: Can <targetApplication> specify an extension as the target?

Alternative: Another way to handle the above example would be to say that extension MYEXT targets Lightning, and Lightning requires Thunderbird or Seamonkey.

This seems more complex than above because it uses <rdf:alt>.

It seems strange because the MYEXT extension doesn't really control whether Lightning installs on Thunderbird or Seamonkey, or say, adds Firefox in the future, so that dependency should not appear in the MYEXT intall.rdf file.

 <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
      xmlns:em="http://www.mozilla.org/2004/em-rdf#">
   <Description about="urn:mozilla:install-manifest">
     <em:id>myext@myorg.org</em:id>
     ...
     <em:targetApplication RDF:resource="rdf:#$sunbird"/>
     <em:targetApplication RDF:resource="rdf:#$lightning"/>
   </Description>
 
   <Description RDF:about="rdf:#$sunbird">
     <em:id>{718e30fb-e89b-41dd-9da7-e25a45638b28}</em:id>
     <em:minVersion>...</em:minVersion>
     <em:maxVersion>...</em:maxVersion>
   </Description>
 
   <Description RDF:about="rdf:#$lightning"/>
     <em:id>{e2fda1a4-762b-4020-b5ad-a41df1933103}</em:id>
     <em:name>Lightning</em:name>
     <em:minVersion>...</em:minVersion>
     <em:maxVersion>...</em:maxVersion>
     <rdf:alt>
       <em:requires RDF:resource="rdf:#$thunderbird"/>
       <em:requires RDF:resource="rdf:#$seamonkey"/>
     </rdf:alt>
   </Description>
 
   <Description RDF:about="rdf:#$thunderbird">
     <em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
     <em:minVersion>...</em:minVersion>
     <em:maxVersion>...</em:maxVersion>
   </Description>
 
   <Description RDF:about="rdf:#$seamonkey">
     <em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id>
     <em:minVersion>...</em:minVersion>
     <em:maxVersion>...</em:maxVersion>
   </Description>
 
 </RDF>

Alternative: A simpler variation on the above would be to allow an extension as the target, and not specify what applications.

This requires changing the extension manager so it compares the extension target ids with not only the application id, but also the the installed extension ids, and does not require the extension manager look in <em:requires> clauses for applications.

(The <targetApplication> element may be misnamed in this case if it also allows extensions. Maybe <targetExtension> could be used instead.)

 <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
      xmlns:em="http://www.mozilla.org/2004/em-rdf#">
   <Description about="urn:mozilla:install-manifest">
     <em:id>myext@myorg.org</em:id>
     ...
     <em:targetApplication RDF:resource="rdf:#$sunbird"/>
     <em:targetApplication RDF:resource="rdf:#$lightning"/>
   </Description>
 
   <Description RDF:about="rdf:#$sunbird">
     <em:id>{718e30fb-e89b-41dd-9da7-e25a45638b28}</em:id>
     <em:minVersion>...</em:minVersion>
     <em:maxVersion>...</em:maxVersion>
   </Description>
 
   <Description RDF:about="rdf:#$lightning"/>
     <em:id>{e2fda1a4-762b-4020-b5ad-a41df1933103}</em:id>
     <em:name>Lightning</em:name>
     <em:minVersion>...</em:minVersion>
     <em:maxVersion>...</em:maxVersion>
   </Description>
 
 </RDF>

Benefit: If the X extension only extends Lightning, it doesn't care about the underlying application, so the version number of the underlying application should not matter as long as the required versions of Lightning work on it.

The current implementation is based on the original em:requires that was documented for 1.0 but never implemented. I probably should have thrown it out and implemented it without any consideration for the existing specification but hindsight is 20/20. I'm also hesitant of making the EM to be a "one-size fits all" implementation in the same way that we don't just add a pref for every possible option someone would want. Robert Strong