이 문서는 아직 자원 봉사자들이 한국어로 번역하지 않았습니다. 함께 해서 번역을 마치도록 도와 주세요!
This document is a reference for the version format, as used in Firefox 1.5 (XULRunner 1.8) and later. This format is used by the Extension Manager, Software Update, and other parts of the platform. Versions in at least the following places must conform to this format:
- Addon's and target application's version in install and update manifests.
- The following preferences:
- Versions returned by
application.iniin XULRunner applications
- appversion flag in chrome manifests.
You can use
nsIVersionComparator to compare versions from your application.
See Older version formats below for description of the older version format used in Firefox/Thunderbird 1.0.
A version string consists of one or more version parts, separated with dots.
Each version part is itself parsed as a sequence of four parts:
<number-a><string-b><number-c><string-d>. Each of the parts is optional. Numbers are integers base 10 (may be negative), strings are non-numeric ASCII characters.
A few examples of valid version parts:
A few special parsing rules are applied for backwards compatibility and readability:
- if the version part is a single asterisk, it is interpreted as an infinitely-large number:
1.5.0.*is the same as
- if string-b is a plus sign, number-a is incremented to be compatible with the Firefox 1.0.x version format:
1.0+is the same as
The rationale behind splitting a version part into a sequence of strings and numbers is that when comparing version parts, the numeric parts are compared as numbers, e.g. '1.0pre1' < '1.0pre10', while the strings are compared bytewise. See the next section for details on how versions are compared.
See maintenance policy for special rules that mark version as "beta" in the AMO queues.
When two version strings are compared, their version parts are compared left to right. An empty or missing version part is equivalent to
If at some point a version part of one version string is greater than the corresponding version part of another version string, then the first version string is greater than the other one.
Otherwise, the version strings are equal. Note, that since missing version parts are treated as if they were
0, the following version strings are equal:
1.0.0, and even
Comparing version parts
Version parts are also compared left to right, parts A and C are compared as numbers, while parts B and D are compared byte-wise. A string-part that exists is always less than a string-part that doesn't exist (
1.6a is less than
1.-1 < 1 == 1. == 1.0 == 1.0.0 < 1.1a < 1.1aa < 1.1ab < 1.1b < 1.1c < 1.1pre == 1.1pre0 == 1.0+ < 1.1pre1a < 1.1pre1aa < 1.1pre1b < 1.1pre1 < 1.1pre2 < 1.1pre10 < 1.1.-1 < 1.1 == 1.1.0 == 1.1.00 < 1.10 < 1.* < 1.*.1 < 2.0
For those interested in seeing the implementation of toolkit version comparison, see nsVersionComparator.cpp.
Older version formats
Firefox and Thunderbird 1.0 used a simpler version format, namely
[..] denotes an optional component, and
build are all non-negative integers.