Why isn't my chrome extension auto-updating itself?

风流意气都作罢 提交于 2019-12-04 02:56:35

I think the error lies in how your web.js file serves updates.xml. Here's my reasoning:

  • I duplicated your setup and saw the same lack of updates.
  • Then I did a second test, using only my public Dropbox folder, and everything went perfectly.
  • Finally, I did two more tests: one with a Node-hosted updates.xml pointing to a Dropbox-hosted file, and another with a Dropbox-hosted updates.xml pointing to a Node-hosted crx file.

The results was that whenever updates.xml was served by Node, Chrome didn't update the extension correctly, and when updates.xml was hosted by Dropbox, everything when fine, regardless of who hosted the crx file. (And I did change the update_url in the manifest and rebuilt/uploaded the extension for each trial).

Exactly why this happens is still a pretty big mystery to me. Here are the HTTP response headers I get when I fetch updates.xml in Chrome (normally, using the address bar; I'm not sniffing the actual net traffic from the update operation, just simulating it):

Dropbox:

HTTP/1.1 200 OK
Server: nginx/1.0.14
Date: ...
Content-Type: application/xml
Transfer-Encoding: chunked
Connection: keep-alive
x-robots-tag: noindex,nofollow
etag: ...
pragma: public
cache-control: max-age=0
Content-Encoding: gzip

Node.js:

HTTP/1.1 200 OK
X-Powered-By: Express
Content-Type: application/xml
Date: ...
Cache-Control: public, max-age=0
Last-Modified: ...
ETag: "..."
Accept-Ranges: bytes
Content-Length: 284
Connection: keep-alive

I thought also it might be a problem with ports (maybe Chrome doesn't like to update from non-80 ports?), and I've now just discovered that serving updates.xml and crx file from my own Apache server on port 80 causes breakage identical to the problem observed with Node.

I wish I had an actual answer for you, but maybe you can run some tests with Dropbox and finally discover what they're doing differently that makes Chrome like their update file.

Since it gets your XML and doesn't update the extension it doesn't like something in your update xml probably. My best guess is that your 'appid' does not match the App ID of the installed Extension. On the page chrome://extensions view the 'ID' of the installed extension and verify that that value matches what is in the update.xml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!