Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/extension/public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "Dramaturg",
"version": "0.27.4",
"description": "Playwright engineer's companion — console, editor, runner, debugger, and recorder in a Chrome side panel.",
"description": "Playwright engineer's companion — console, editor, runner, debugger, and recorder in a browser side panel.",
"permissions": [
"activeTab",
"tabs",
Expand Down
5 changes: 3 additions & 2 deletions packages/extension/src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ async function ensureCrxApp(): Promise<CrxApplication> {
function isAttachableUrl(url: string | undefined): boolean {
if (!url) return true; // no URL info — let attachToTab decide
if (url.startsWith('chrome://')) return false;
if (url.startsWith('edge://')) return false;
if (url.startsWith('https://chromewebstore.google.com')) return false;
if (url.startsWith('chrome-extension://') && !url.startsWith(`chrome-extension://${chrome.runtime.id}/`)) return false;
return true;
Expand Down Expand Up @@ -207,14 +208,14 @@ async function attachToTab(tabId: number): Promise<{ ok: boolean; url?: string;
const tab = await chrome.tabs.get(tabId);
const ownOrigin = `chrome-extension://${chrome.runtime.id}/`;
const url = tab.url ?? '';
if (url.startsWith('chrome://') ||
if (url.startsWith('chrome://') || url.startsWith('edge://') ||
(url.startsWith('chrome-extension://') && !url.startsWith(ownOrigin)) ||
url.startsWith('https://chromewebstore.google.com')) {
if (activeTabId === tabId) {
activeTabId = null;
currentPage = null;
}
return { ok: false, error: 'Cannot attach to this page — Chrome restricts extension access. Navigate to a regular webpage first.' };
return { ok: false, error: 'Cannot attach to this page — browser restricts extension access. Navigate to a regular webpage first.' };
}

const app = await ensureCrxApp();
Expand Down
5 changes: 3 additions & 2 deletions packages/extension/src/panel/components/Toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@ function Toolbar({ editorContent, editorMode, stepLine, attachedUrl, attachedTab

function isInternalUrl(url: string | undefined) {
if (!url) return true;
return url.startsWith('chrome://') || url.startsWith('chrome-extension://');
return url.startsWith('chrome://') || url.startsWith('edge://') || url.startsWith('chrome-extension://');
}

function getTabLabel(tab: chrome.tabs.Tab): string {
try {
if (tab.url?.startsWith('about:')) return tab.url;
const url = new URL(tab.url!);
if (url.protocol === 'chrome:') return `chrome://${url.hostname}`;
if (url.protocol === 'edge:') return `edge://${url.hostname}`;
return url.hostname;
} catch {
return tab.url ?? '(unknown)';
Expand Down Expand Up @@ -282,7 +283,7 @@ function Toolbar({ editorContent, editorMode, stepLine, attachedUrl, attachedTab

setIsRecording(true);

if (result.url && result.url !== 'about:blank' && !result.url.startsWith('chrome://') && isEditorEmpty()) {
if (result.url && result.url !== 'about:blank' && !result.url.startsWith('chrome://') && !result.url.startsWith('edge://') && isEditorEmpty()) {
const gotoCmd = editorMode === 'js'
? `await page.goto(${JSON.stringify(result.url)});`
: `goto "${result.url}"`;
Expand Down
Loading