gcm

The gcm permission grants an extension access to chrome.gcm, an API for receiving server-sent push messages. The "GCM" branding is legacy — Google Cloud Messaging was rebranded to Firebase Cloud Messaging (FCM) in 2018, but the extension API itself still works in current Chrome and continues to be supported for extensions.

What it does

  • Lets the extension register with the FCM service via chrome.gcm.register(senderIds) and receive a registration token unique to that user/install.
  • The extension forwards the token to its own backend, which can then send push messages to the registration token via FCM's HTTP / HTTP v1 API.
  • Chrome wakes the extension's service worker and dispatches the payload via chrome.gcm.onMessage.
  • Messages are limited to 4 KB of payload data per message.

Modern Alternatives

For new extensions you have a few options. chrome.gcm is still the only built-in extension push channel; the alternatives below trade away true server push for simplicity:

  1. chrome.gcm — best fit when you need real push (low-latency, server-initiated) without keeping a connection open.
  2. WebSockets — the service worker can keep a connection open while it has work to do, but Chrome aggressively shuts down idle service workers, so long-lived sockets are awkward to maintain.
  3. Polling with chrome.alarms — periodic fetch from a chrome.alarms listener. Simple, but not real-time.

When to use it

Use gcm for extensions that need timely server-initiated updates without holding a connection open.

Examples:

  • A chat extension that surfaces a notification for new messages.
  • A sync extension that needs to invalidate local caches when remote data changes.
  • A monitoring extension that pushes alerts when a watched condition fires.

Manifest Declaration

{
  "name": "My GCM Extension",
  "version": "1.0",
  "manifest_version": 3,
  "permissions": [
    "gcm",
    "notifications"
  ],
  "background": {
    "service_worker": "background.js"
  }
}

Security & Privacy

Why is it low risk?

The permission only lets the extension receive messages from servers it has registered with. It doesn't expose user data to the server beyond whatever the extension explicitly sends; the registration token itself is opaque and tied to the user's specific Chrome install of this extension.

The risk is mostly indirect: an attacker who steals the registration token from your backend can spam the user with push notifications until the user removes the extension or you rotate the token.

API Usage Example

// background.js

// Register on install. Use your FCM project's sender ID.
chrome.runtime.onInstalled.addListener(() => {
  chrome.gcm.register(['1234567890'], (registrationId) => {
    if (chrome.runtime.lastError) {
      console.error('GCM registration failed:', chrome.runtime.lastError.message);
      return;
    }
    console.log('GCM registration ID:', registrationId);
    // Send registrationId to your server so it can target this client.
  });
});

// Receive incoming push messages.
chrome.gcm.onMessage.addListener((message) => {
  console.log('Push message received:', message.data);
  chrome.notifications.create({
    type: 'basic',
    iconUrl: 'icon.png',
    title: 'New message',
    message: message.data?.body ?? '(no body)'
  });
});

// Optional: surface send errors (e.g., quota or auth issues).
chrome.gcm.onSendError.addListener((error) => {
  console.error('GCM send error:', error);
});

Extensions with the gcm permission

Here are some popular browser extensions that use the "gcm" permission. To explore more, try our Advanced search.

Permission Metrics

Popularity

Security Risk


Usage by Platform