OLD | NEW |
(Empty) | |
| 1 <div id="pageData-title" class="pageData">AutoUpdate</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 |
| 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> |
| 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> |
| 9 |
| 10 |
| 11 <h2>Overview</h2> |
| 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> |
| 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> |
| 16 |
| 17 |
| 18 <h3>Update URL</h3> |
| 19 <p>For those who are hosting their own extensions, you need to add the "update_u
rl" key to your manifest.json file like this:</p> |
| 20 <pre>{ |
| 21 "name": "Test Extension", |
| 22 "version": "1.0", |
| 23 "description": "My test extension", |
| 24 <b>"update_url": "http://myhost.com/mytestextension/updates.xml"</b>, |
| 25 "toolstrips": ["mytoolstrip.html"] |
| 26 } |
| 27 </pre> |
| 28 |
| 29 <h3>Update Manifest</h3> |
| 30 <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> |
| 31 |
| 32 <pre> |
| 33 <?xml version='1.0' encoding='UTF-8'?> |
| 34 <gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'> |
| 35 <app appid='<b>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</b>'> |
| 36 <updatecheck codebase='<b>http://myhost.com/mytestextension/mte
_v2.crx</b>' version='<b>2.0</b>' /> |
| 37 </app> |
| 38 </gupdate> |
| 39 </pre> |
| 40 |
| 41 <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> |
| 42 |
| 43 <p><b>appid</b><br> |
| 44 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> |
| 45 |
| 46 <p><b>codebase</b><br> |
| 47 The 'codebase' property is a url to the crx file.</p> |
| 48 |
| 49 <p><b>version</b><br> |
| 50 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> |
| 51 <p>The update manifest xml file may contain information about multiple extension
s by including multiple <code><app></code> tags.</p> |
| 52 |
| 53 |
| 54 <h3>Testing</h3> |
| 55 <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> |
| 56 <pre> |
| 57 chrome.exe <b>--extensions-update-frequency=45</b></pre> |
| 58 |
| 59 <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> |
| 60 |
| 61 <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> |
| 62 |
| 63 |
| 64 <h3>Advanced Usage : Request Parameters</h3> |
| 65 <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> |
| 66 <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> |
| 67 <p>The format of the request parameters is:</p> |
| 68 <p><code> ?x=<extension_data></code></p> |
| 69 <p>where <code><extension_data></code> is an url-encoded string of the for
mat:</p> |
| 70 <p><code> id=<id>&v=<version></code></p> |
| 71 |
| 72 <p>So for example, say we have two extensions installed</p> |
| 73 <p> Extension 1 with id "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" and versio
n "1.1"<br> |
| 74 Extension 2 with id "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" and version "
0.4"</p> |
| 75 |
| 76 <p>and that both point at the same update_url: <code>http://test.com/extension_u
pdates.php</code></p> |
| 77 |
| 78 <p>The two requests made would be:</p> |
| 79 <code>http://test.com/extension_updates.php?x=id%3Daaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaa%26v%3D1.1</code> |
| 80 <br> |
| 81 <code>http://test.com/extension_updates.php?x=id%3Dbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
bbb%26v%3D0.4</code> |
| 82 |
| 83 <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> |
| 84 |
| 85 <h4>Future work for Request Parameters</h4> |
| 86 <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> |
| 87 <p><code>http://test.com/extension_updates.php?x=id%3Daaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaa%26v%3D1.1&x=id%3Dbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb%26v%3D0.4</code></p
> |
| 88 |
| 89 <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> |
| 90 |
| 91 |
| 92 <h3>Advanced Usage : Minimum Browser Version</h3> |
| 93 <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> |
| 94 |
| 95 <pre><?xml version='1.0' encoding='UTF-8'?> |
| 96 <gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'> |
| 97 <app appid='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'> |
| 98 <updatecheck codebase='http://myhost.com/mytestextens
ion/mte_v2.crx' version='2.0' <b>prodversionmin='3.0.193.0'</b>/> |
| 99 </app> |
| 100 </gupdate> |
| 101 </pre> |
| 102 |
| 103 <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> |
| 104 |
OLD | NEW |