Skip to content

The design language that makes your AI harness better at design.

JavaScript

Fix Firefox DevTools extension paths (#231)

Paul Bakaus9381269a82c1
diff --git a/extension/devtools/devtools.js b/extension/devtools/devtools.js
index cebb52534..00450e611 100644
--- a/extension/devtools/devtools.js
+++ b/extension/devtools/devtools.js
@@ -8,13 +8,13 @@
chrome.devtools.panels.create(
'Impeccable',
- 'icons/icon-32.png',
- 'devtools/panel.html'
+ '/icons/icon-32.png',
+ '/devtools/panel.html'
);
// Sidebar pane in the Elements panel: shows findings for the currently selected element
chrome.devtools.panels.elements.createSidebarPane('Impeccable', (sidebar) => {
- sidebar.setPage('devtools/sidebar.html');
+ sidebar.setPage('/devtools/sidebar.html');
sidebar.setHeight('200px');
});
diff --git a/scripts/test-suites.mjs b/scripts/test-suites.mjs
index 134093030..68205a0fd 100644
--- a/scripts/test-suites.mjs
+++ b/scripts/test-suites.mjs
@@ -68,7 +68,7 @@ export const SUITES = {
/^extension\/(background|content|detector|devtools|popup|manifest\.json)/,
/^scripts\/(benchmark-detector|build-browser-detector|build-extension)\.js$/,
/^site\/(pages\/detector|public\/antipattern|data\/anti-patterns-catalog\.js)/,
- /^tests\/(detect-antipatterns|fixtures\/antipatterns)/,
+ /^tests\/(detect-antipatterns|extension-build|fixtures\/antipatterns)/,
],
commands: [
{
@@ -81,6 +81,7 @@ export const SUITES = {
{
runner: 'node',
files: [
+ 'tests/extension-build.test.mjs',
'tests/detect-antipatterns-fixtures.test.mjs',
'tests/detect-antipatterns-browser.test.mjs',
],
diff --git a/tests/extension-build.test.mjs b/tests/extension-build.test.mjs
new file mode 100644
index 000000000..53d7243c8
--- /dev/null
+++ b/tests/extension-build.test.mjs
@@ -0,0 +1,22 @@
+import { describe, it } from 'node:test';
+import assert from 'node:assert/strict';
+import { readFileSync } from 'node:fs';
+import { fileURLToPath } from 'node:url';
+import path from 'node:path';
+
+const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
+
+describe('extension DevTools packaging', () => {
+ it('uses extension-root paths for DevTools panel pages', () => {
+ const source = readFileSync(path.join(ROOT, 'extension/devtools/devtools.js'), 'utf-8');
+
+ assert.match(
+ source,
+ /chrome\.devtools\.panels\.create\(\s*['"]Impeccable['"],\s*['"]\/icons\/icon-32\.png['"],\s*['"]\/devtools\/panel\.html['"]\s*\)/s,
+ 'Firefox resolves DevTools URLs relative to devtools.html unless they start at the extension root',
+ );
+ assert.match(source, /sidebar\.setPage\(['"]\/devtools\/sidebar\.html['"]\)/);
+ assert.doesNotMatch(source, /['"]devtools\/(?:panel|sidebar)\.html['"]/);
+ assert.doesNotMatch(source, /['"]icons\/icon-32\.png['"]/);
+ });
+});