My favorites | Sign in
Project Home Downloads Wiki Issues Code Search
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 134319: chrome.runtime.onInstalled should mention it is fired on updates
39 people starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  mpcomplete@chromium.org
Closed:  Sep 2012


Sign in to add a comment
 
Reported by fam....@live.nl, Jun 23, 2012
Extension event pages ( chrome.runtime ) should have an onUpdated method. This would allow developers to:

Example 1:
Update their settings if version X stored settings differently than version Y (for example, version X could store something as an array (useful if you just have to store one thing) and version Y wants to store them as objects, because you want to store more properties of an item.
For example, you used to have (key -- value)
"customURLs" -- "[\"http://x.y/\ \"http://foo.bar/\"]"
and you want to convert it to
"custom" -- "[\"name1\", \"name2\"]"
"name1" -- "{url: \"...\", property2: \"...\"}"
"name2" -- "{url: \"...\", property2: \"...\"}"

Example 2:
Add new functionality. For example, you added support for context menu items in version Y and you want to show it by default.

Example 3: 
Changed something. For example, you translated a context menu item as "Say hello to the Chrme developers", noticed the typo and released a fix. Existing users won't notice the fix, as the background page is never launched to update it's menu.


Currently, you'd have to either
1. wait for the user to open an extension page which can do the things you want to do. However, average users don't open the options page daily I assume, so it could happen that it takes years before you are finally able to get rid of your 'conversion code'.
2. make a call from the content scripts. However, content scripts can't tell if you just updated or not, so you'd have to launch it every time a script loads on a page.
Both workarounds (especially the latter) seem much worse than running a background page 24/7.

(Another option is to modify the onInstalled event to also fire on a version update)
Jul 3, 2012
#1 a...@chromium.org
Agree. Can we just add a previousVersion argument to onInstalled?

code.google.com/chrome/extensions/trunk/runtime.html#event-onInstalled
Status: Assigned
Owner: mpcomplete@chromium.org
Labels: -Type-Bug -Area-Undefined -OS-Windows Type-Feature Area-Internals OS-All Feature-Extensions
Jul 3, 2012
#2 a...@chromium.org
(No comment was entered for this change.)
Blocking: chromium:81752
Jul 25, 2012
#3 mpcomplete@chromium.org
Actually, onInstalled already fires on version update. It doesn't include a previousVersion argument, but given the context of this feature request, it doesn't seem necessary. If they extension is storing data, it can know what version the data was written by, and it knows what version it is now.

I'm going to close this WontFix. If I'm missing something, and a previousVersion argument is actually useful, please reopen.
Status: WontFix
Jul 26, 2012
#4 fam....@live.nl
Hi mpcomplete,
In that case you'll have to update the documentation of the method. It currently says: 
Fired when the extension is first installed.

This implies that it will not fire when updating from an older version.
Jul 26, 2012
#5 mpcomplete@chromium.org
Thanks, will do.
Summary: chrome.runtime.onInstalled should mention it is fired on updates
Status: Assigned
Jul 30, 2012
#6 bugdro...@chromium.org
The following revision refers to this bug:
    http://src.chromium.org/viewvc/chrome?view=rev&revision=148956

------------------------------------------------------------------------
r148956 | mpcomplete@chromium.org | 2012-07-30T15:58:29.141302Z

Changed paths:
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/api/runtime.json?r1=148956&r2=148955&pathrev=148956
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/extensions/runtime.html?r1=148956&r2=148955&pathrev=148956
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/apps/runtime.html?r1=148956&r2=148955&pathrev=148956

Fix the chrome.runtime.onInstalled docs to note it fires for updates as well.

BUG=134319


Review URL: https://chromiumcodereview.appspot.com/10833070
------------------------------------------------------------------------
Jul 30, 2012
#7 mpcomplete@chromium.org
(No comment was entered for this change.)
Status: Fixed
Sep 17, 2012
#8 mpcomplete@chromium.org
Reopening because it turns out it makes sense to include the info about whether onInstalled is firing for an install or an update.
Status: Started
Sep 17, 2012
#10 bugdro...@chromium.org
The following revision refers to this bug:
    http://src.chromium.org/viewvc/chrome?view=rev&revision=157219

------------------------------------------------------------------------
r157219 | mpcomplete@chromium.org | 2012-09-17T22:27:06.937925Z

Changed paths:
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/api/runtime.json?r1=157219&r2=157218&pathrev=157219
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/api/runtime/runtime_api.cc?r1=157219&r2=157218&pathrev=157219
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/api/runtime/runtime_api.h?r1=157219&r2=157218&pathrev=157219
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/event_router.cc?r1=157219&r2=157218&pathrev=157219

Provide details about why we're dispatching runtime.onInstalled.

Also, unregister for the event after dispatching,
so we don't end up littering Preferences.

BUG=134319,145842

Review URL: https://chromiumcodereview.appspot.com/10916308
------------------------------------------------------------------------
Oct 15, 2012
#11 mek@chromium.org
 Issue 26229  has been merged into this issue.
Mar 10, 2013
#12 bugdro...@chromium.org
(No comment was entered for this change.)
Labels: -Area-Internals -Feature-Extensions Cr-Internals Cr-Platform-Extensions
Sign in to add a comment

Powered by Google Project Hosting