Tablio is a Chrome extension built with vanilla JavaScript following Chrome Extension Manifest V3 architecture. The extension uses a service worker for background operations and provides both popup and options page interfaces.
- Purpose: Handles workspace operations, storage management, and Chrome API interactions
- Key Functions:
saveWorkspace()- Captures current tabs and windowsrestoreWorkspace()- Opens saved tabs and groupscleanDuplicateWorkspaces()- Removes duplicate entries- Tab group management and persistence
- Storage: Uses
chrome.storage.syncfor cross-device synchronization - Error Handling: Comprehensive try-catch blocks with user notifications
- Purpose: Primary user interface for quick workspace actions
- Features:
- Collapsible workspace sections
- Context menus for workspace actions
- Recent workspaces with preview cards
- Theme switching (light/dark/auto)
- Quick actions (close all, remove duplicates)
- Security: XSS-protected DOM manipulation using
createElementandtextContent
- Purpose: Advanced workspace management and settings
- Features:
- Workspace editing with tab management
- Analytics dashboard with usage statistics
- Auto-clean settings configuration
- Import/export functionality
- Chrome-like tab grouping with visual color picker
- Purpose: Secure replacement for browser alerts/confirms
- Security: XSS-safe DOM construction without
innerHTML - Features: Custom styling, keyboard navigation, CSP compliance
User Action → Popup/Options → Background Service Worker → Chrome APIs → Storage
↓ ↓ ↓ ↓ ↓
UI Update ← DOM Update ← Message Response ← API Response ← Data Sync
{
workspaces: {
"workspace-id": {
name: "string",
tabs: [{ url: "string", title: "string", groupId: number }],
groups: [{ id: number, title: "string", color: "string" }],
createdAt: timestamp,
lastUsed: timestamp
}
},
settings: {
autoClean: boolean,
theme: "light|dark|auto",
autoSaveInterval: number
},
analytics: {
workspacesCreated: number,
workspacesRestored: number,
lastUsed: timestamp
}
}- No use of
innerHTMLoreval() - All DOM manipulation uses
createElementandtextContent - CSP headers prevent inline scripts
{
"content_security_policy": {
"extension_pages": "script-src 'self'; object-src 'self'"
}
}- All user inputs validated and sanitized
- URL validation for tab restoration
- Character limits enforced (workspace names: 20 chars, tab titles: 50 chars)
- Aggressive limits: 3 workspaces max, 5 tabs each
- Automatic cleanup of old/duplicate workspaces
- Compressed data structures
- Debounced search and filter operations
- Lazy loading of workspace previews
- CSS animations with
transformfor GPU acceleration
- Event listeners properly removed on cleanup
- Chrome API calls wrapped in error handling
- Background script optimized for minimal resource usage
{
"permissions": [
"tabs", // Read/modify browser tabs
"storage", // Sync data across devices
"windows", // Manage browser windows
"scripting", // Execute scripts in tabs
"activeTab", // Access current active tab
"tabGroups", // Manage Chrome tab groups
"notifications" // Show system notifications
]
}/tablio/
├── manifest.json # Extension configuration & permissions
├── background.js # Service worker - core business logic
├── popup.html/js # Main UI - workspace switching
├── options.html/js # Settings - advanced management
├── modal.js # Secure modal system
├── prompt.js # Secure prompt dialogs
├── css/style.css # Comprehensive styling
└── icons/ # Extension assets
chrome.tabs- Tab management and queryingchrome.windows- Window operationschrome.storage.sync- Cross-device data synchronizationchrome.tabGroups- Tab grouping functionalitychrome.notifications- User notificationschrome.scripting- Content script injection
// Popup → Background
chrome.runtime.sendMessage({
action: 'saveWorkspace',
data: { name: 'Work Session' }
});
// Background → Popup
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
// Handle workspace operations
});- Try-catch blocks around all Chrome API calls
- Graceful degradation for missing permissions
- User notifications for critical errors
- Input validation with user feedback
- Loading states for async operations
- Fallback UI for failed operations
- Quota limit handling
- Data corruption recovery
- Sync conflict resolution
- Cross-browser compatibility (Chrome focus)
- Permission scenarios
- Storage quota limits
- Network connectivity issues
- XSS attack vectors
- CSP compliance
- Input sanitization
- Permission escalation
- Local unpacked extension loading
- Developer mode testing
- Hot reload for rapid iteration
- Chrome Web Store distribution
- Automatic updates via Chrome
- Analytics and crash reporting
- Firefox WebExtension compatibility
- Cloud backup API integration
- Multi-browser sync protocols
- IndexedDB for larger datasets
- Web Workers for heavy computations
- Service Worker caching strategies
- Enhanced CSP policies
- Permission minimization
- Encrypted storage options