Skip to main content
Version: v1 (Current)

Browser Extensions

The GxP Toolkit includes browser extensions for Chrome and Firefox that provide advanced development and debugging capabilities for your plugins.

Overview​

The GxP Developer Toolkit extension combines a request proxy in its toolbar popup with a GxP Inspector DevTools panel. The panel allows you to:

  • Inspect Vue components and their props/data
  • Select elements on the page to view their GxP attributes
  • Highlight elements with visual feedback during selection
  • Extract hardcoded strings and convert them to gxp-string directives
  • Read selected component metadata and available GxP attributes

Quick Start​

Launch with Development Server​

The easiest way to use the extensions is to launch them with the dev server:

# Chrome
gxdev dev --chrome

# Firefox
gxdev dev --firefox

# Both
gxdev dev --chrome --firefox

These commands request the following services:

  1. Starts the Vite development server
  2. Launches the browser with the extension loaded
  3. Navigates to your dev server URL

Launch Extension Only​

If the dev server is already running:

# Chrome
gxdev ext:chrome

# Firefox
gxdev ext:firefox

Installation Methods​

Temporary Installation (Development)​

Firefox uses a temporary development add-on. The Chrome launcher supplies extension-loading flags and a shared profile at /tmp/chrome-extension-test; do not assume a fresh browser profile on every launch. Confirm that the extension actually appears in the browser before testing it.

Permanent Installation​

For persistent access during development:

Chrome​

gxdev ext:install chrome

Then follow the instructions:

  1. Open chrome://extensions/
  2. Enable Developer mode (toggle in top-right)
  3. Click Load unpacked
  4. Select the extension directory shown in the terminal

An accepted unpacked installation is associated with that browser profile; verify it remains enabled after restarting and follow any browser/organization restrictions. After code changes, click the refresh icon on the extension card.

Firefox​

gxdev ext:install firefox

Option 1: Temporary Add-on (easiest)

  1. Open about:debugging#/runtime/this-firefox
  2. Click Load Temporary Add-on...
  3. Select any file in the extension directory

Note: Temporary add-ons are removed when Firefox closes.

For persistent Firefox distribution, package and sign the extension, then install the resulting .xpi file. Selecting manifest.json is a temporary development workflow, not a persistent installation procedure. See Mozilla signing and distribution.

The toolkit wrapper requires a separate, exact Firefox tooling installation:

npm install --prefix "$HOME/.gxp/browser-tools" --save-exact web-ext@10.7.0

Set GXP_BROWSER_TOOLS_DIR if you use a different tooling directory. The wrapper checks the installed package version; it does not download missing tooling automatically. Some instructions printed by ext:install firefox are older than this workflow.

Browser permissions and scope​

Both bundled manifests request page access beyond localhost (<all_urls>), so a dev-server URL is not the installation boundary. Verify the extension/profile and tab access you actually enabled before testing a portal.

BuildDeclared integration
Chrome Manifest V3Declarative request rules, storage, active-tab/scripting, request observation, notifications and browsing-data controls
Firefox Manifest V2Blocking request hooks, tabs, storage, notifications and browsing-data controls

Manifest declarations describe requested capabilities, not proof that a browser grants every operation. The Chrome blocking-path limitation below remains separate from declarative redirects. Use a deliberate development profile and review proxy/cache state before returning to ordinary browsing. Selected component state can include application data; share only the relevant redacted details when reporting an issue.

Extension Features​

Preview a local plugin inside a portal​

The popup configures JavaScript and CSS rules separately. A rule contains an enabled switch, a URL pattern, and a redirect target. The JavaScript default matches plugin-version upload URLs under file_name and redirects to https://localhost:3060/src/Plugin.vue. The Chrome CSS default matches style_file_name uploads and requests an empty stylesheet. Firefox’s initial configuration leaves its CSS rule disabled; inspect the saved popup configuration instead of assuming identical browser defaults.

  1. Start the local development server and verify that its plugin URL is reachable.
  2. Open the extension popup, enable the proxy, and set the JavaScript redirect URL to your actual local entry point.
  3. Use a custom pattern when necessary to match the intended portal resource. A broad pattern can replace other plugins on the same page.
  4. Save the configuration, reload the portal, and inspect the browser Network panel to confirm which request redirected.
  5. Disable the proxy when you finish previewing the local plugin.

Saving validates enabled rules and stores their configuration in browser sync storage. A successful save confirms configuration storage; it does not confirm that the browser accepted every interception rule or that the portal loaded your local code.

Chrome's standard redirect path uses dynamic declarative rules, restricted to script or stylesheet resource types. Blank responses, masking mode, and cache-header changes use a separate blocking request-listener path. Those paths need separate browser acceptance checks; inspect extension background errors if JavaScript redirects work but CSS blanking does not.

Chrome restricts blocking webRequest in Manifest V3 to policy-installed extensions. The toolkit's current Chrome manifest declares webRequest but not webRequestBlocking, while its secondary path registers blocking listeners. Treat that path as an implementation compatibility limitation rather than a guaranteed feature of an unpacked installation. See Chrome's webRequest permission requirements.

The extension requests access to all URLs and permissions for request handling, storage, notifications, cache operations, and script injection. The clear cache on enable path invokes browser-cache removal for all origins, then attempts pattern-based service-worker cache cleanup. Its effect is broader than clearing one plugin URL. Configure this option deliberately in the browser profile you use for development.

DevTools Panel​

Open Chrome/Firefox DevTools (F12 or Cmd+Opt+I) and look for the GxP Inspector tab.

Element Selection Mode​

  1. Click the selection icon in the panel toolbar
  2. Hover over elements on the page - they highlight with an orange dashed border
  3. Click an element to select it - it shows a cyan pulsing glow
  4. View element details in the inspector panel. The click exits selection mode while preserving the selected element/highlight. Enabling selection again clears the previous selected-element reference; use clearSelection() to explicitly deselect.

Visual Highlighting​

StateStyle
HoverOrange dashed border
SelectedCyan pulsing glow
GxP StringBlue indicator badge

Smart Labels​

Selected elements are labeled with context information:

ComponentName::element::gxp-string-key

Examples:

  • DemoPage::h1::welcome_title
  • CheckInForm::button::btn_submit
  • Header::img::logo

This shows:

  1. Vue component name containing the element
  2. HTML element type (h1, button, img, etc.)
  3. GxP string key if the element has a gxp-string attribute

Component Inspector​

View details about the selected element's Vue component:

  • Component Name - Vue component that contains the element
  • Props - Available props serialized from the detected Vue instance
  • Data - Reactive data properties
  • Setup state - Values exposed by the component’s setup state; serialized values can fall back to strings
  • GxP Attributes - gxp-string, gxp-src, gxp-state, etc.

String Extraction​

Convert hardcoded strings to GxP directives:

  1. Select an element with hardcoded text
  2. Click Extract to gxp-string in the inspector
  3. Enter a key name (e.g., welcome_title)
  4. Submit the extraction. When connected to the local inspector API, this writes the Vue source file and the string entry in app-manifest.json:
<!-- Before -->
<h1>Welcome to the Event</h1>

<!-- After -->
<h1 gxp-string="welcome_title">Welcome to the Event</h1>

Review the resulting Git diff before continuing. Extraction uses template-text matching and can affect multiple matching occurrences. The server writes the Vue file before updating the manifest, so a malformed manifest can leave a partial edit.

The current inspector panel targets https://localhost:3060/__gxp-inspector. Changing the development server port or using HTTP does not update this hardcoded address. A working page preview alone does not prove that extraction is connected.

Connection and source-writing boundary​

The panel's connection indicator comes from the local inspector API's /ping response. It does not prove page-context injection, Vue component detection, a correct source-file match or a successful edit. Diagnose those separately: inspect the selected component/file, the request to the fixed HTTPS/3060 inspector origin, its JSON result and the resulting source diff. A successful local preview or proxy redirect is not evidence that extraction is connected.

This API runs with the development server's filesystem access. In the reviewed handlers, /file and /update-file resolve supplied paths without a project-root containment check, and the handlers themselves do not require a per-request credential. A direct-handler test reproduced reading/updating a synthetic sibling file outside a synthetic project. That is a local handler limitation, not a claim that every deployed host/proxy makes it remotely reachable.

Keep the source-writing development endpoint within an intended trusted development boundary. The managed Vite config allows network binding (host: true); check the actual listener and proxy exposure before sharing a preview. A saved popup configuration or connection indicator is not an authorization boundary for local source writes. The platform's production project permissions are a separate system.

When a file update requests a backup, the handler uses one adjacent .backup file; later updates can replace it. This is not a transaction or a complete undo history. Keep source under version control and review the diff after an edit or error, especially where source changes can precede manifest changes.

Element Tree​

The current panel displays details for the selected element, including text entries, props, and setup-state data. Its component-tree sidebar is marked as a future feature in the panel source. Do not expect a browsable component hierarchy or the previously documented S/A/T DOM-tree badges.

Firefox proxy differences​

Firefox uses a Manifest V2 background script with blocking request listeners. Its background handler matches script and stylesheet resource types separately, and avoids redirecting localhost requests. The content script also wraps fetch and XHR URLs in its own execution context; that does not establish interception of every page request or module import.

Masking mode takes a different route from ordinary redirects. Keep it disabled for the basic portal-preview workflow and use the Network panel to verify actual request destinations. Browser integration remains necessary to confirm the effect of background listeners, page context, CSP, and cache controls together.

Extension Architecture​

Chrome Extension (Manifest V3)​

browser-extensions/chrome/
├── manifest.json # Extension manifest (V3)
├── devtools.html # DevTools page loader
├── devtools.js # DevTools initialization
├── panel.html # Inspector panel UI
├── panel.js # Panel logic
├── popup.html / popup.js # Proxy controls
├── inspector.js # Page-context selection API
├── content.js # Content script (injected)
├── background.js # Service worker
└── icons/ # Extension icons

Firefox Extension​

browser-extensions/firefox/
├── manifest.json # Extension manifest
├── devtools.html
├── devtools.js
├── panel.html
├── panel.js
├── popup.html / popup.js
├── inspector.js
├── content.js
├── background.js
└── icons/

Content Script​

The content script (content.js) is injected into your development page and provides:

Element Selection​

The injected inspector exposes a development-only API in the page context:

window.gxpInspector?.enable()
window.gxpInspector?.disable()
window.gxpInspector?.clearSelection()

The content-script bridge uses this message shape:

window.postMessage({
type: "GXP_INSPECTOR_ACTION",
action: "enable", // also "disable" or "toggleInspector"
}, "*")

These helpers require successful inspector injection. The previously documented GXP_HIGHLIGHT_ELEMENT, GXP_ENABLE_SELECTION, and GXP_GET_COMPONENT_INFO message names are not supported by the current implementation.

Building Extensions​

Build extensions for distribution:

gxdev ext:build

The command builds Firefox first, then Chrome. A failed Firefox tooling/build stage stops the command before Chrome packaging; inspect the stage and printed source/output directory instead of interpreting a missing Chrome ZIP as a Chrome-specific failure. The handlers can select project-local extension files or toolkit fallbacks.

With the bundled versions this creates:

dist/
├── chrome/
│ └── gx-chrome-extension-v1.2.zip # Version comes from manifest.json
└── firefox/
└── <web-ext-generated-name>.zip # Unsigned build archive

Chrome Packaging​

The Chrome extension is packaged using the pack-chrome.js script, which:

  1. Creates a ZIP of the extension files
  2. Names it gx-chrome-extension-v<manifest-version>.zip

The script does not generate a CRX or sign the extension. Use Load unpacked with the source directory for local development.

Firefox Packaging​

The Firefox extension is built using the separately installed web-ext@10.7.0. Its build archive is unsigned; signing and persistent distribution are separate steps. From a toolkit source checkout, the wrapper invocation is:

node scripts/web-ext.js build --source-dir browser-extensions/firefox --artifacts-dir dist/firefox

Reloading Extensions​

After modifying extension code:

Chrome​

  1. Go to chrome://extensions
  2. Find GxP Developer Toolkit
  3. Click the refresh icon on the extension card

Firefox​

  1. Go to about:debugging
  2. Find GxP Developer Toolkit
  3. Click Reload

Console Logging​

The extension logs to both the page console and DevTools console:

[GxP Inspector] Loaded
[GxP Inspector] Element selected: h1.welcome-title
[GxP Inspector] Component: DemoPage

Use the page, DevTools panel, and extension background consoles to locate errors.

Troubleshooting​

Extension not loading​

  • Check the actual target tab origin and the enabled extension/profile. Portal preview can run on a non-localhost page while redirecting selected resources to the local server.
  • Check that the extension is enabled in chrome://extensions or about:addons
  • Look for errors in the browser console

Element highlighting not working​

  • Refresh the page after loading the extension
  • Check for [GxP Inspector] Loaded in the console
  • Ensure the content script has permission for the page

Vue component not detected​

  • Make sure Vue DevTools extension isn't conflicting
  • Check that your Vue app is in development mode
  • The component must be mounted when inspection starts

Selection mode stuck​

  • A successful click normally exits selection mode but preserves the selection; distinguish an active selector from its persistent highlight
  • Click the selection icon again to toggle off
  • Refresh the page to reset state

Integration with Dev Tools​

The extension complements the in-browser Dev Tools:

FeatureIn-Browser Dev ToolsBrowser Extension
Store inspectionFull store editorRead-only view
Element highlightingVia store keysVia click selection
String extractionManualWrites source and manifest; review the diff
Component inspectionBasicDetailed
Layout switchingYesNo
Socket simulationYesNo

Use both together for the best development experience:

  • In-browser Dev Tools (Ctrl+Shift+D) for store manipulation
  • Browser Extension for element inspection and string extraction