Chrome Extension Storage Changes — Manifest V3 Guide

4 min read

Storage API Changes in Manifest V3

Why Storage Matters More in MV3

What Changed

Storage Areas

| Area | Limit | Persistence | Sync | Use Case | |——|——-|————-|——|———-| | local | 10 MB | Device only | No | Large data, caches, sensitive data | | sync | 100 KB total, 8 KB/item | All devices | Yes | User preferences, settings | | session | 10 MB | Browser session | No | Temporary state (Chrome 102+, MV3 only) | | managed | Policy-defined | Read-only | Enterprise | Admin-configured settings |

session Storage (Chrome 102+, MV3 only)

// Persists across SW terminations but NOT browser restarts
await chrome.storage.session.set({ tempData: "value" });
const { tempData } = await chrome.storage.session.get("tempData");

Promise-Based API (MV3)

// MV2 style (callbacks)
chrome.storage.local.get('key', (result) => { console.log(result.key); });

// MV3 style (promises)
const { key } = await chrome.storage.local.get('key');

Migration from MV2 Background Page State

// MV2: in-memory state (worked because background was persistent)
let cache = {};
chrome.runtime.onMessage.addListener((msg) => {
  cache[msg.key] = msg.value; // Worked fine
});

// MV3: must persist to storage
const storage = createStorage(defineSchema({ cache: 'string' }), 'session');
chrome.runtime.onMessage.addListener(async (msg) => {
  const cache = JSON.parse(await storage.get('cache') || '{}');
  cache[msg.key] = msg.value;
  await storage.set('cache', JSON.stringify(cache));
});

Performance Considerations

Storage Quotas

Common MV3 Storage Patterns

Common Mistakes

Part of the Chrome Extension Guide by theluckystrike. Built at zovo.one.