| OLD | NEW |
| 1 <div id="pageData-title" class="pageData">Autoupdating</div> | 1 <div id="pageData-title" class="pageData">Autoupdating</div> |
| 2 <div id="pageData-showTOC" class="pageData">true</div> | 2 <div id="pageData-showTOC" class="pageData">true</div> |
| 3 <h2>Introduction</h2> | |
| 4 <p>We want extensions to be autoupdated for some of the same reasons as chrome i
tself: to incorporate bug and security fixes, add new features or performance en
hancements, and improve user interfaces.</p> | |
| 5 | 3 |
| 6 <p>For extensions packaged and distributed via the extensions gallery, developer
s will be able to use a web interface to release updated versions of their exten
sions and do not need to concern themselves with the rest of this document.</p> | 4 <p>We want extensions to be autoupdated for some of the same reasons as Google C
hrome itself: to incorporate bug and security fixes, add new features or perform
ance enhancements, and improve user interfaces.</p> |
| 5 |
| 6 <p>For extensions packaged and distributed via the gallery, developers will be a
ble to use a web interface to release updated versions of their extensions and d
o not need to concern themselves with the rest of this document.</p> |
| 7 | 7 |
| 8 <p>Those who choose to host extensions themselves instead of using the gallery w
ill probably want to use autoupdate for their extensions as described below. You
might want to make sure you are familiar with <a href="packaging.html">Packagin
g</a> first.</p> | 8 <p>Those who choose to host extensions themselves instead of using the gallery w
ill probably want to use autoupdate for their extensions as described below. You
might want to make sure you are familiar with <a href="packaging.html">Packagin
g</a> first.</p> |
| 9 | 9 |
| 10 | 10 |
| 11 <h2>Overview</h2> | 11 <h2>Overview</h2> |
| 12 <ul><li>An extension manifest may contain an "update_url" for doing update check
s.</li> | 12 <ul><li>An extension manifest may contain an "update_url" for doing update check
s.</li> |
| 13 <li>The content returned by an update check is an "update manifest" xml document
listing the latest version of an extension (or set of extensions, more on that
later).</li></ul> | 13 <li>The content returned by an update check is an "update manifest" XML document
listing the latest version of an extension (or set of extensions, more on that
later).</li></ul> |
| 14 | 14 |
| 15 <p>Every few hours, the browser will check if any installed extensions have an a
utoupdate url. For each one, it will make a request to that url looking for an u
pdate manifest xml file. If the update manifest mentions a version of an extensi
on that is more recent than what's installed, it will download and install the n
ew version. Similar to manual updates, the new crx must be signed with the same
private key as the currently installed version.</p> | 15 <p>Every few hours, the browser will check if any installed extensions have an a
utoupdate URL. For each one, it will make a request to that URL looking for an u
pdate manifest XML file. If the update manifest mentions a version of an extensi
on that is more recent than what's installed, it will download and install the n
ew version. Similar to manual updates, the new crx must be signed with the same
private key as the currently installed version.</p> |
| 16 | 16 |
| 17 | 17 |
| 18 <h3>Update URL</h3> | 18 <h2>Update URL</h2> |
| 19 <p>For those who are hosting their own extensions, you need to add the "update_u
rl" key to your <a href="manifest.html">manifest.json</a> file like this:</p> | 19 <p>For those who are hosting their own extensions, you need to add the "update_u
rl" key to your <a href="manifest.html">manifest.json</a> file like this:</p> |
| 20 <pre>{ | 20 <pre>{ |
| 21 ... | 21 ... |
| 22 "update_url": "http://myhost.com/mytestextension/updates.xml", | 22 "update_url": "http://myhost.com/mytestextension/updates.xml", |
| 23 ... | 23 ... |
| 24 } | 24 } |
| 25 </pre> | 25 </pre> |
| 26 | 26 |
| 27 <h3>Update Manifest</h3> | 27 <h2>Update manifest</h2> |
| 28 <p>The "update manifest" returned by the server should be an xml document t
hat looks like this (parts you'll want to modify highlighted):</p> | 28 <p>The "update manifest" returned by the server should be an XML document t
hat looks like this (parts you'll want to modify highlighted):</p> |
| 29 | 29 |
| 30 <pre> | 30 <pre> |
| 31 <?xml version='1.0' encoding='UTF-8'?> | 31 <?xml version='1.0' encoding='UTF-8'?> |
| 32 <gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'> | 32 <gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'> |
| 33 <app appid='<b>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</b>'> | 33 <app appid='<b>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</b>'> |
| 34 <updatecheck codebase='<b>http://myhost.com/mytestextension/mte
_v2.crx</b>' version='<b>2.0</b>' /> | 34 <updatecheck codebase='<b>http://myhost.com/mytestextension/mte
_v2.crx</b>' version='<b>2.0</b>' /> |
| 35 </app> | 35 </app> |
| 36 </gupdate> | 36 </gupdate> |
| 37 </pre> | 37 </pre> |
| 38 | 38 |
| 39 <p>(This xml format is borrowed from that used by Omaha, Google's update infrast
ructure. See <a href="http://code.google.com/p/omaha/">http://code.google.com/p/
omaha/</a> for more details.)</p> | 39 <p>(This XML format is borrowed from that used by Omaha, Google's update infrast
ructure. See <a href="http://code.google.com/p/omaha/">http://code.google.com/p/
omaha/</a> for more details.)</p> |
| 40 | 40 |
| 41 <p><b>appid</b><br> | 41 <p><b>appid</b><br> |
| 42 The 'appid' property is the extension id, generated based on a hash of the exten
sion's public key as described in <a href="packaging.html">Packaging</a>. You ca
n find out the id of your extension by going to chrome://extensions/ in a chrome
browser where you have the extension installed.</p> | 42 The 'appid' property is the extension id, generated based on a hash of the exten
sion's public key as described in <a href="packaging.html">Packaging</a>. You ca
n find out the id of your extension by going to <b>chrome://extensions</b>.</p> |
| 43 | 43 |
| 44 <p><b>codebase</b><br> | 44 <p><b>codebase</b><br> |
| 45 The 'codebase' property is a url to the crx file.</p> | 45 The 'codebase' property is a URL to the crx file.</p> |
| 46 | 46 |
| 47 <p><b>version</b><br> | 47 <p><b>version</b><br> |
| 48 This is used by the client to determine whether it should download the crx file
at 'codebase'. It should match the version parameter in the crx file's manifest.
json file.</p> | 48 This is used by the client to determine whether it should download the crx file
at 'codebase'. It should match the version parameter in the crx file's manifest.
json file.</p> |
| 49 <p>The update manifest xml file may contain information about multiple extension
s by including multiple <code><app></code> tags.</p> | 49 <p>The update manifest XML file may contain information about multiple extension
s by including multiple <code><app></code> tags.</p> |
| 50 | 50 |
| 51 | 51 |
| 52 <h3>Testing</h3> | 52 <h2>Testing</h2> |
| 53 <p>The default update check frequency is several hours, which obviously makes te
sting challenging. To overcome this, you can use the --extensions-update-frequen
cy command line flag to set a more frequent interval in seconds. For instance, t
o make checks run every 45 seconds, you would run chrome like this:</p> | 53 <p>The default update check frequency is several hours, |
| 54 but you can force an update using the Extensions page's |
| 55 <b>Update extensions now</b> button. |
| 56 </p> |
| 57 |
| 58 <p> |
| 59 Another option is to use the --extensions-update-frequency command-line flag to
set a more frequent interval in seconds. For instance, to make checks run every
45 seconds, you would run Google Chrome like this:</p> |
| 54 <pre> | 60 <pre> |
| 55 chrome.exe <b>--extensions-update-frequency=45</b></pre> | 61 chrome.exe <b>--extensions-update-frequency=45</b></pre> |
| 56 | 62 |
| 57 <p>Note that this affects checks for all installed extensions, so consider the b
andwidth and server load implications of this. You may want to temporarily unins
tall all but the one extension you are testing with, and should not run with thi
s option turned on during normal browser usage. In the future we may remove this
command flag and replace it with a different mechanism to trigger update checks
for testing (perhaps a button on the chrome://extensions page). Star the follow
ing issue to receive updates: <a href="http://crbug.com/17853" rel="nofollow">ht
tp://crbug.com/17853</a>.</p> | 63 <p>Note that this affects checks for all installed extensions, so consider the b
andwidth and server load implications of this. You may want to temporarily unins
tall all but the one extension you are testing with, and should not run with thi
s option turned on during normal browser usage.</p> |
| 58 | |
| 59 <p><b>Addendum:</b> the "Update now" button has been added, and will be present
in dev channel builds soon (likely 4.0.207.x and above).</p> | |
| 60 | 64 |
| 61 | 65 |
| 62 <h3>Advanced Usage : Request Parameters</h3> | 66 <h2>Advanced usage: request parameters</h2> |
| 63 <p>The basic autoupdate mechanism is designed to make the server-side work as ea
sy as just dropping a static xml file onto any plain webserver such as apache, a
nd updating that xml file as you release new versions of your extension(s).</p> | 67 <p>The basic autoupdate mechanism is designed to make the server-side work as ea
sy as just dropping a static XML file onto any plain webserver such as apache, a
nd updating that XML file as you release new versions of your extension(s).</p> |
| 64 <p>More advanced developers may wish to take advantage of the fact that we add o
n parameters to the request for the update manifest to indicate the extension id
and version. Then they can use the same update_url for all of their extensions
pointing to a url running dynamic server side code instead of a static xml file.
</p> | 68 <p>More advanced developers may wish to take advantage of the fact that we add o
n parameters to the request for the update manifest to indicate the extension id
and version. Then they can use the same update_url for all of their extensions
pointing to a URL running dynamic server side code instead of a static XML file.
</p> |
| 65 <p>The format of the request parameters is:</p> | 69 <p>The format of the request parameters is:</p> |
| 66 <p><code> ?x=<extension_data></code></p> | 70 <p><code> ?x=<extension_data></code></p> |
| 67 <p>where <code><extension_data></code> is an url-encoded string of the for
mat:</p> | 71 <p>where <code><extension_data></code> is an URL-encoded string of the for
mat:</p> |
| 68 <p><code> id=<id>&v=<version></code></p> | 72 <p><code> id=<id>&v=<version></code></p> |
| 69 | 73 |
| 70 <p>So for example, say we have two extensions installed</p> | 74 <p>So for example, say we have two extensions installed</p> |
| 71 <p> Extension 1 with id "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" and versio
n "1.1"<br> | 75 <p> Extension 1 with id "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" and versio
n "1.1"<br> |
| 72 Extension 2 with id "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" and version "
0.4"</p> | 76 Extension 2 with id "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" and version "
0.4"</p> |
| 73 | 77 |
| 74 <p>and that both point at the same update_url: <code>http://test.com/extension_u
pdates.php</code></p> | 78 <p>and that both point at the same update_url: <code>http://test.com/extension_u
pdates.php</code></p> |
| 75 | 79 |
| 76 <p>The two requests made would be:</p> | 80 <p>The two requests made would be:</p> |
| 77 <code>http://test.com/extension_updates.php?x=id%3Daaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaa%26v%3D1.1</code> | 81 <code>http://test.com/extension_updates.php?x=id%3Daaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaa%26v%3D1.1</code> |
| 78 <br> | 82 <br> |
| 79 <code>http://test.com/extension_updates.php?x=id%3Dbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
bbb%26v%3D0.4</code> | 83 <code>http://test.com/extension_updates.php?x=id%3Dbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
bbb%26v%3D0.4</code> |
| 80 | 84 |
| 81 <p><b>Note</b>: in releases before 3.0.196.x there was a bug in how request para
meters were put together (<a href="http://crbug.com/17469" rel="nofollow">http:/
/crbug.com/17469</a>).</p> | 85 <p><b>Note</b>: in releases before 3.0.196.x there was a bug in how request para
meters were put together (<a href="http://crbug.com/17469" rel="nofollow">http:/
/crbug.com/17469</a>).</p> |
| 82 | 86 |
| 83 <h4>Future work for Request Parameters</h4> | 87 <h3>Future work</h3> |
| 84 <p>While not implemented yet, we will eventually list multiple extensions in a s
ingle request for each unique update_url. For the above example, the request wou
ld end up being:</p> | 88 <p>While not implemented yet, we will eventually list multiple extensions in a s
ingle request for each unique update_url. For the above example, the request wou
ld end up being:</p> |
| 85 <p><code>http://test.com/extension_updates.php?x=id%3Daaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaa%26v%3D1.1&x=id%3Dbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb%26v%3D0.4</code></p
> | 89 <p><code>http://test.com/extension_updates.php?x=id%3Daaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaa%26v%3D1.1&x=id%3Dbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb%26v%3D0.4</code></p
> |
| 86 | 90 |
| 87 <p>If the number of installed extensions using the same update_url is large enou
gh that a GET request url would be too long (probably greater than 1024 characte
rs or so), the update check will instead issue a POST with the request parameter
s in the POST body.</p> | 91 <p>If the number of installed extensions using the same update_url is large enou
gh that a GET request URL would be too long (probably greater than 1024 characte
rs or so), the update check will instead issue a POST with the request parameter
s in the POST body.</p> |
| 88 | 92 |
| 89 | 93 |
| 90 <h3>Advanced Usage : Minimum Browser Version</h3> | 94 <h2>Advanced usage: minimum browser version</h2> |
| 91 <p>As we add more API's to the extensions system, it's possible you will want to
release an updated version of an extension that will only work with newer versi
ons of the chrome browser. While chrome itself is autoupdated, it can take a few
days before the majority of the userbase has updated to any given new release.
To ensure that a given extension update will only apply to chrome version at or
higher than a specific version, you would add the prodversionmin parameter to th
e <code><app></code> tag in your update manifest. For example:</p> | 95 <p>As we add more APIs to the extensions system, it's possible you will want to
release an updated version of an extension that will only work with newer versio
ns of the browser. While Google Chrome itself is autoupdated, it can take a few
days before the majority of the user base has updated to any given new release.
To ensure that a given extension update will apply only to Google Chrome version
s at or higher than a specific version, you would add the prodversionmin paramet
er to the <code><app></code> tag in your update manifest. For example:</p> |
| 92 | 96 |
| 93 <pre><?xml version='1.0' encoding='UTF-8'?> | 97 <pre><?xml version='1.0' encoding='UTF-8'?> |
| 94 <gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'> | 98 <gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'> |
| 95 <app appid='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'> | 99 <app appid='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'> |
| 96 <updatecheck codebase='http://myhost.com/mytestextens
ion/mte_v2.crx' version='2.0' <b>prodversionmin='3.0.193.0'</b>/> | 100 <updatecheck codebase='http://myhost.com/mytestextens
ion/mte_v2.crx' version='2.0' <b>prodversionmin='3.0.193.0'</b>/> |
| 97 </app> | 101 </app> |
| 98 </gupdate> | 102 </gupdate> |
| 99 </pre> | 103 </pre> |
| 100 | 104 |
| 101 <p>This would ensure that users of this extension would only autoupdate to versi
on 2 if they are running chrome 3.0.193.0 or greater.</p> | 105 <p>This would ensure that users of this extension would autoupdate to version 2
only if they are running Google Chrome 3.0.193.0 or greater.</p> |
| 102 | 106 |
| OLD | NEW |