Closed Bug 1445739 Opened 2 years ago Closed 2 years ago

Don't invalidate the startup cache when webextensions are installed/uninstalled


(Toolkit :: Add-ons Manager, enhancement, P2)




Tracking Status
firefox67 --- fixed


(Reporter: aswan, Assigned: Gijs)



(Whiteboard: [fxperf:p1])


(1 file)

In the days of legacy extensions that could register chrome: and resource: scripts, we had to flush the startup cache every time an extension was uninstall (or updated) to purge any cached scripts from the old version.  No code from a pure webextension should end up in the startup cache so we can avoid an unnecessary (and potentitally expensive) flush when those are uninstalled.
Priority: -- → P2
Duplicate of this bug: 1515488
Kris and I talked about this today. I assume this would be straightforward to fix, and it should have positive real-world startup impact.
Whiteboard: [fxperf]
At least formautofill still provides some chrome: and resource: assets:

So it will need to flush in the case of a hot-update.  In practice, I don't think we've ever shipped an out-of-cycle update to formautofill but it would be good to avoid leaving this as a trap in the event that we ever want to ship one...
We never planned to support hot updates so that's why we implemented onUpdateAvailable:

Adding a comment there about the startup cache may be worthwhile.

This seems like a quick and cheap potential start-up win.

Whiteboard: [fxperf] → [fxperf:p1]
Assignee: nobody → gijskruitbosch+bugs
Attachment #9040744 - Attachment description: Bug 1445739 - invalidate only the extensions cache when extensions change, r?aswan → Bug 1445739 - stop invalidating the startup cache when extensions change, r?kmag
Pushed by
stop invalidating the startup cache when extensions change, r=kmag

Backed out changeset 41a84186eb77 (Bug 1445739) for test_startup.js failures.

Push with failures:

Backout link:

Failure log:

[task 2019-02-07T01:07:37.447Z] 01:07:37 INFO - TEST-START | toolkit/components/url-classifier/tests/unit/test_listmanager.js
[task 2019-02-07T01:07:39.226Z] 01:07:39 INFO - TEST-PASS | toolkit/components/url-classifier/tests/unit/test_listmanager.js | took 1783ms
[task 2019-02-07T01:07:39.242Z] 01:07:39 INFO - TEST-START | toolkit/modules/subprocess/test/xpcshell/test_subprocess.js
[task 2019-02-07T01:07:47.247Z] 01:07:47 INFO - TEST-PASS | toolkit/modules/subprocess/test/xpcshell/test_subprocess.js | took 8004ms
[task 2019-02-07T01:07:47.251Z] 01:07:47 INFO - TEST-START | xpcshell.ini:toolkit/mozapps/extensions/test/xpcshell/test_startup.js
[task 2019-02-07T01:12:47.251Z] 01:12:47 WARNING - TEST-UNEXPECTED-TIMEOUT | xpcshell.ini:toolkit/mozapps/extensions/test/xpcshell/test_startup.js | Test timed out
[task 2019-02-07T01:12:47.253Z] 01:12:47 INFO - TEST-INFO took 300001ms
[task 2019-02-07T01:12:47.255Z] 01:12:47 INFO - >>>>>>>
[task 2019-02-07T01:12:47.256Z] 01:12:47 INFO - PID 15307 | [15307, Main Thread] WARNING: Couldn't get the user appdata directory. Crash events may not be produced.: file /builds/worker/workspace/build/src/toolkit/crashreporter/nsExceptionHandler.cpp, line 2536
[task 2019-02-07T01:12:47.258Z] 01:12:47 INFO - PID 15307 | JavaScript strict warning: resource://testing-common/AddonTestUtils.jsm, line 315: ReferenceError: reference to undefined property "testScope"
[task 2019-02-07T01:12:47.259Z] 01:12:47 INFO - "CONSOLE_MESSAGE: (warn) [JavaScript Warning: "ReferenceError: reference to undefined property "testScope"" {file: "resource://testing-common/AddonTestUtils.jsm" line: 315}]"
[task 2019-02-07T01:12:47.260Z] 01:12:47 INFO - (xpcshell/head.js) | test MAIN run_test pending (1)
[task 2019-02-07T01:12:47.261Z] 01:12:47 INFO - (xpcshell/head.js) | test run_next_test 0 pending (2)
[task 2019-02-07T01:12:47.262Z] 01:12:47 INFO - (xpcshell/head.js) | test MAIN run_test finished (2)
[task 2019-02-07T01:12:47.263Z] 01:12:47 INFO - running event loop
[task 2019-02-07T01:12:47.264Z] 01:12:47 INFO - xpcshell.ini:toolkit/mozapps/extensions/test/xpcshell/test_startup.js | Starting setup
[task 2019-02-07T01:12:47.265Z] 01:12:47 INFO - (xpcshell/head.js) | test setup pending (2)
[task 2019-02-07T01:12:47.265Z] 01:12:47 INFO - PID 15307 | 1549501667702 addons.manager DEBUG Application has been upgraded
[task 2019-02-07T01:12:47.266Z] 01:12:47 INFO - PID 15307 | 1549501667744 addons.manager DEBUG Loaded provider scope for resource://gre/modules/addons/XPIProvider.jsm: ["XPIProvider", "XPIInternal"]
[task 2019-02-07T01:12:47.267Z] 01:12:47 INFO - PID 15307 | 1549501667754 addons.manager DEBUG Loaded provider scope for resource://gre/modules/LightweightThemeManager.jsm: ["LightweightThemeManager"]
[task 2019-02-07T01:12:47.268Z] 01:12:47 INFO - PID 15307 | 1549501667767 addons.manager DEBUG Loaded provider scope for resource://gre/modules/addons/GMPProvider.jsm
[task 2019-02-07T01:12:47.269Z] 01:12:47 INFO - PID 15307 | 1549501667772 addons.manager DEBUG Loaded provider scope for resource://gre/modules/addons/PluginProvider.jsm
[task 2019-02-07T01:12:47.270Z] 01:12:47 INFO - PID 15307 | 1549501667774 addons.manager DEBUG Starting provider: XPIProvider
[task 2019-02-07T01:12:47.271Z] 01:12:47 INFO - PID 15307 | 1549501667775 addons.xpi DEBUG startup
[task 2019-02-07T01:12:47.272Z] 01:12:47 INFO - PID 15307 | 1549501667776 addons.xpi WARN List of valid built-in add-ons could not be parsed.: [Exception... "Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIXPCComponents_Utils.readUTF8URI]" nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)" location: "JS frame :: resource://gre/modules/addons/XPIProvider.jsm :: startup :: line 2202" data: no] Stack trace: startup()@resource://gre/modules/addons/XPIProvider.jsm:2202
[task 2019-02-07T01:12:47.273Z] 01:12:47 INFO - PID 15307 | callProvider()@resource://gre/modules/AddonManager.jsm:204
[task 2019-02-07T01:12:47.274Z] 01:12:47 INFO - PID 15307 | _startProvider()@resource://gre/modules/AddonManager.jsm:653
[task 2019-02-07T01:12:47.274Z] 01:12:47 INFO - PID 15307 | startup()@resource://gre/modules/AddonManager.jsm:806
[task 2019-02-07T01:12:47.275Z] 01:12:47 INFO - PID 15307 | startup()@resource://gre/modules/AddonManager.jsm:2788
[task 2019-02-07T01:12:47.276Z] 01:12:47 INFO - PID 15307 | observe()@jar:file:///builds/worker/workspace/build/application/firefox/omni.ja!/components/addonManager.js:66
[task 2019-02-07T01:12:47.277Z] 01:12:47 INFO - PID 15307 | promiseStartupManager()@resource://testing-common/AddonTestUtils.jsm:780

Flags: needinfo?(gijskruitbosch+bugs)

The test_startup.js stuff is trivial, it's the android failures that I don't understand...

See Also: → 1526086

Thanks to kmag for pointing out that android seems to be stuck trying to write the startupcache now that we're not invalidating it all the time. I filed bug 1526086 about that.

Hopefully this is sufficient to fix:

Pushed by
stop invalidating the startup cache when extensions change, r=kmag
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla67
Flags: needinfo?(gijskruitbosch+bugs)
Depends on: 1527821
You need to log in before you can comment on or make changes to this bug.