Skip to content

26.7.11 It seems that the background page failed to load #9818

Closed

Description

@Nick2bad4u

Description

The new update is causing this for me, and it's breaking features like clicking the icon to go to a url etc.

On some urls I do see this bug, though I'm not sure if releated:

Uncaught (in promise) Error: Access to storage is not allowed from this context.

Coming from feature-manager.js:144

How to replicate the issue + URL

Warning here: extension://hlepfoohegkhhmjieoechaddaejaokhf/assets/options.html

Broken on all urls but example: https://github.com/refined-github/refined-github/releases/tag/26.7.11

When I click on Inspect views service worker; (Inactive)
It appears to go active for a second then back to inactive, but not long enough for me to open and see any errors.

Extension version

Version 26.7.11

Browser(s) used

Edge Version 150.0.4078.65 (Official build) (64-bit)

Token ⚠️

  • I set a token in the options page. I understand that some features require a token to work.

Ive tried to reinstall, use only default settings, restart edge.

I turned on collect errors and I see this:

Image

Errors:

Service worker registration failed. Status code: 15
{
   "$schema": "https://json.schemastore.org/chrome-manifest",
   "action": {
      "default_icon": "assets/icon.png"
   },
   "background": {
      "scripts": [ "assets/background.js" ],
      "service_worker": "assets/background.js",
      "type": "module"
   },
   "browser_specific_settings": {
      "gecko": {
         "id": "{a4c4eda4-fb84-4a84-b4a1-f7c1cbf2a1ad}",
         "strict_min_version": "128.0"
      },
      "gecko_android": {
         "strict_min_version": "128.0"
      }
   },
   "content_scripts": [ {
      "css": [ "assets/refined-github.css" ],
      "exclude_matches": [ "https://*/login/*" ],
      "js": [ "assets/content-script.js" ],
      "matches": [ "https://github.com/*", "https://gist.github.com/*" ],
      "run_at": "document_start"
   } ],
   "description": "Simplifies the GitHub interface and adds useful features",
   "homepage_url": "https://github.com/refined-github/refined-github",
   "host_permissions": [ "https://github.com/*", "https://api.github.com/*" ],
   "icons": {
      "128": "assets/icon.png"
   },
   "key": "DELETEDFORSAFETY",
   "manifest_version": 3,
   "minimum_chrome_version": "123",
   "name": "Refined GitHub",
   "optional_host_permissions": [ "*://*/*" ],
   "options_page": "assets/options.html",
   "permissions": [ "storage", "scripting", "contextMenus", "activeTab", "alarms" ],
   "update_url": "https://clients2.google.com/service/update2/crx",
   "version": "26.7.11",
   "web_accessible_resources": [ {
      "matches": [ "https://*/*" ],
      "resources": [ "assets/*" ]
   } ]
}
 

and

Uncaught (in promise) Error: Access to storage is not allowed from this context.
Context
https://github.com/refined-github/refined-github
Stack Trace
extensions://hlepfoohegkhhmjieoechaddaejaokhf/assets/feature-manager.js ((anonymous function)):144:1
import React from './npm/dom-chef.js';
import domLoaded from './npm/dom-loaded.js';
import { is500, isPasswordConfirmation } from './npm/github-url-detection.js';
import oneEvent from './npm/one-event.js';
import { elementExists } from './npm/select-dom.js';
import stripIndent from './npm/strip-indent.js';
import { isWebPage } from './npm/webext-detect.js';
import { messageRuntime } from './npm/webext-msg.js';
import { expectToken } from './github-helpers/github-token.js';
import asyncForEach from './helpers/async-for-each.js';
import bisectFeatures from './helpers/bisect.js';
import { catchErrors, disableErrorLogging } from './helpers/errors.js';
import { listenToAjaxedLoad, log, getFeatureId, shortcutMap } from './helpers/feature-helpers.js';
import { isFeaturePrivate, shouldFeatureRun } from './helpers/feature-utils.js';
import { getLocalHotfixesAsOptions, preloadSyncLocalStrings, applyStyleHotfixes, brokenFeatures } from './helpers/hotfix.js';
import ArrayMap from './helpers/map-of-arrays.js';
import waitFor from './helpers/wait-for.js';
import optionsStorage, { isFeatureDisabled } from './options-storage.js';
import { contentScriptToggle } from './options/reload-without.js';

/* eslint-disable no-await-in-loop -- Event loops */

































const currentFeatureControllers = new ArrayMap();

function unloadAll() {
	for (const feature of currentFeatureControllers.values()) {
		for (const controller of feature) {
			controller.abort();
		}
	}

	currentFeatureControllers.clear();
}

// eslint-disable-next-line no-async-promise-executor -- Rule assumes we don't want to leave it pending
const globalReady = new Promise(async resolve => {
	if (!isWebPage()) {
		throw new Error('This script should only be run on web pages');
	}

	listenToAjaxedLoad();

	const [options, willLoadContentScripts, localHotfixes, bisectedFeatures] = await Promise.all([
		optionsStorage.getAll(),
		contentScriptToggle.get(),
		getLocalHotfixesAsOptions(),
		bisectFeatures(),
		preloadSyncLocalStrings(),
	]);

	if (!willLoadContentScripts) {
		await contentScriptToggle.remove();
		const message = 'Refined GitHub: scripts were disabled for this load, but CSS can’t be disabled this way.';
		console.warn(message);
		alert(message);
		return;
	}

	log.setup(options);

	await waitFor(() => document.body);

	if (is500() || isPasswordConfirmation()) {
		return;
	}

	if (elementExists('[refined-github]')) {
		console.warn(stripIndent(`
			Refined GitHub has been loaded twice. This may be because:

			• You loaded the developer version, or
			• The extension just updated

			If you see this at every load, please open an issue mentioning the browser you're using and the URL where this appears.
		`));
		return;
	}

	document.documentElement.setAttribute('refined-github', '');

	// Request in the background page to avoid showing a 404 request in the console
	// https://github.com/refined-github/refined-github/issues/6433
	// eslint-disable-next-line promise/prefer-await-to-then -- Reads as a callback
	void messageRuntime({getStyleHotfixes: true}).then(applyStyleHotfixes);

	if (options.customCss.trim().length > 0) {
		// Review #5857 and #5493 before making changes
		document.head.append(React.createElement('style', null, options.customCss));
	}

	if (bisectedFeatures) {
		Object.assign(options, bisectedFeatures);
	} else {
		// If features are remotely marked as "seriously breaking" by the maintainers, disable them without having to wait for proper updates to propagate #3529
		void brokenFeatures.get();
		Object.assign(options, localHotfixes);
	}

	if (elementExists('body.logged-out')) {
		console.warn('Refined GitHub is only expected to work when you’re logged in to GitHub. Errors will not be shown.');
		disableErrorLogging();
	} else {
		catchErrors();
	}

	// Detect unload via two events to catch both clicks and history navigation
	// https://github.com/refined-github/refined-github/issues/6437#issuecomment-1489921988
	document.addEventListener('turbo:before-fetch-request', unloadAll); // Clicks
	document.addEventListener('turbo:visit', unloadAll); // Back/forward button

	resolve(options);
});

function castArray(value) {
	return Array.isArray(value) ? value : [value];
}

async function add(url, ...loaders) {
	const id = getFeatureId(url);

	/* Feature filtering and running */
	const options = await globalReady;

	// Skip disabled features, unless the feature is private
	if (isFeatureDisabled(options, id) && !isFeaturePrivate(id)) {
		if (loaders.length === 0) {
			// CSS-only https://github.com/refined-github/refined-github/issues/7944
			// GitHub cleans up the CSS disabling attributes after navigation.
			// https://github.com/refined-github/refined-github/issues/8172
			do {
				document.documentElement.setAttribute('rgh-OFF-' + id, '');
				log.info('↩️', 'Skipping', id);
			} while (await oneEvent(document, 'turbo:render'));
		} else {
			log.info('↩️', 'Skipping', id);
		}

		return;
	}

	if (loaders.length === 0) {
		// CSS-only
		return;
	}

	void asyncForEach(loaders, async loader => {
		// Input defaults and validation
		const {
			shortcuts = {},
			asLongAs,
			include,
			exclude,
			init,
			awaitDomReady = false,
			requiresToken = false,
			deduplicate = false,
		} = loader;

		if (include?.length === 0) {
			throw new Error(`${id}: \`include\` cannot be an empty array, it means "run nowhere"`);
		}

		let isFirstLoop = true;
		do {
			if (awaitDomReady) {
				await domLoaded;
			}

			if (isFirstLoop) {
				isFirstLoop = false;
			} else if (deduplicate !== false && elementExists(deduplicate)) {
				continue;
			}

			if (!await shouldFeatureRun({asLongAs, include, exclude})) {
				continue;
			}

			if (requiresToken) {
				await expectToken();
			}

			const featureController = new AbortController();
			currentFeatureControllers.append(id, featureController);

			// Do not await, or else an error on a page will break the feature completely until a reload
			void asyncForEach(castArray(init), async singleInit => {
				const didRun = await singleInit(featureController.signal);
				// Features can return `false` when they decide not to run on the current page
				if (didRun !== false && !isFeaturePrivate(id)) {
					log.info('✅', id);
					// Register feature shortcuts
					for (const [hotkey, description] of Object.entries(shortcuts)) {
						shortcutMap.set(hotkey, description);
					}
				}
			});
		} while (await oneEvent(document, 'turbo:render'));
	});
}

async function addCssFeature(url) {
	void add(url);
}

function unload(featureUrl) {
	const id = getFeatureId(featureUrl);
	for (const controller of currentFeatureControllers.get(id) ?? []) {
		controller.abort();
	}
}

const features = {
	add,
	unload,
	addCssFeature,
};

export { features as default };
 

Activity

  1. changed the title [-][Bug] It seems that the background page failed to load[/-] [+]It seems that the background page failed to load[/+] on Jul 12, 2026
  2. changed the title [-]It seems that the background page failed to load[/-] [+]26.7.11 It seems that the background page failed to load[/+] on Jul 12, 2026
  3. fregante commented on Jul 12, 2026

    @fregante
    Member

    Thanks for the detailed report! I think "Access to storage is not allowed from this context" is not what's causing the background page to fail since it should definitely have access to all storage.

    To see what's causing the worker to fail: https://developer.chrome.com/docs/workbox/service-worker-overview

    1. open chrome://serviceworker-internals/
    2. check "Open DevTools and pause..." checkbox
    3. Go reload the extension
    4. Click "Play" to resume executing
    5. See the error in the console tab
  4. fregante commented on Jul 12, 2026

    @fregante
    Member

    Ugh, it seems that some file is importing dom-utils and it's crashing when accessing screen

    const _isSmallDevice = screen.width < 500;
  5. fregante commented on Jul 12, 2026

    @fregante
    Member

    Found it: background -> open-tabs -> toast -> dom-utils.js

  6. self-assigned this
    on Jul 12, 2026
  7. fregante commented on Jul 12, 2026

    @fregante
    Member

    v26.7.12 released

  8. Nick2bad4u commented on Jul 12, 2026

    @Nick2bad4u
    Author

    Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions