Closed Bug 1387907 Opened 2 years ago Closed 2 years ago

Store computed module data in the startup cache

Categories

(WebExtensions :: General, enhancement)

enhancement
Not set

Tracking

(firefox57 fixed)

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: kmag, Assigned: kmag)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Computing this at startup takes several milliseconds. We can load the computed data from the startup cache virtually for free.
Comment on attachment 8894370 [details]
Bug 1387907: Merge ext-browser.js and ext-utils.js.

https://reviewboard.mozilla.org/r/165544/#review170862

::: browser/components/extensions/ext-browser.js:96
(Diff revision 1)
>    let viewId = `addons://detail/${encodeURIComponent(extension.id)}/preferences`;
>  
>    return window.BrowserOpenAddonsMgr(viewId);
>  };
> +
> +global.makeWidgetId = id => {

this looks like a straightforward copy, I didn't examine this too closely.
Attachment #8894370 - Flags: review?(mixedpuppy) → review+
Comment on attachment 8894369 [details]
Bug 1387907: Store computed module data in the startup cache.

https://reviewboard.mozilla.org/r/165542/#review170878

::: toolkit/components/extensions/ExtensionParent.jsm:1382
(Diff revision 1)
>  };
>  
> -let StartupCache = {
> +StartupCache = {
>    DB_NAME: "ExtensionStartupCache",
>  
> -  STORE_NAMES: Object.freeze(["general", "locales", "manifests", "permissions", "schemas"]),
> +  STORE_NAMES: Object.freeze(["general", "locales", "manifests", "other", "permissions", "schemas"]),

IMO "modules" would be better than "other"
Attachment #8894369 - Flags: review?(mixedpuppy) → review+
Comment on attachment 8894369 [details]
Bug 1387907: Store computed module data in the startup cache.

https://reviewboard.mozilla.org/r/165542/#review170878

> IMO "modules" would be better than "other"

I don't want to keep creating new top-level stores every time we have something new to store. At this point, we should really probably have two stores, one for extension-specific data (locales, manifests... permissions are probably a special case), and one for global data (schemas, modules, ...), so I'm trying to move in that direction.

The current setup made more sense when it was backed by IndexedDB, but there's not much benefit to it now.
https://hg.mozilla.org/integration/mozilla-inbound/rev/85af5aa841d16d58ae42d6f2e349e690f4a825e6
Bug 1387907: Follow-up: Move identity module init data to ext-browser.json.
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.