diff --git a/special-pages/pages/errorpage/app/errorpage.md b/special-pages/pages/errorpage/app/errorpage.md new file mode 100644 index 0000000000..fd221327a5 --- /dev/null +++ b/special-pages/pages/errorpage/app/errorpage.md @@ -0,0 +1,34 @@ +--- +title: Error Page +--- + +# Error Page + +A simple error page template for browser loading failures. Unlike other special pages, this page does not use messaging—native interacts via string interpolation and a global callback. + +## String Interpolation + +Native performs string replacement on the HTML before loading: + +| Variable | Description | +|----------|-------------| +| `$HEADER$` | Error title text | +| `$ERROR_DESCRIPTION$` | Error description text | +| `$THEME_VARIANT$` | Theme variant name (falls back to default if not replaced) | + +## Runtime Theme Updates + +Native can update the theme by calling: + +```javascript +window.onChangeTheme({ themeVariant: 'coolGray' }); +``` + +**Payload:** +```json +{ + "themeVariant": "violet" +} +``` + +Available theme variants: `default`, `coolGray`, `slateBlue`, `green`, `violet`, `rose`, `orange`, `desert` diff --git a/special-pages/pages/history/app/history.md b/special-pages/pages/history/app/history.md index 0618279c5b..2d210a7b2d 100644 --- a/special-pages/pages/history/app/history.md +++ b/special-pages/pages/history/app/history.md @@ -20,11 +20,13 @@ Configure initial history system settings. "env": "production", "platform": { "name": "macos" - } + }, + "theme": "light", + "themeVariant": "default" } ``` -With {@link "History Messages".DefaultStyles} overrides +With a different theme variant: ```json { @@ -33,15 +35,13 @@ With {@link "History Messages".DefaultStyles} overrides "platform": { "name": "macos" }, - "customizer": { - "defaultStyles": { - "lightBackgroundColor": "#E9EBEC", - "darkBackgroundColor": "#27282A" - } - } + "theme": "dark", + "themeVariant": "violet" } ``` +Available theme variants: `default`, `coolGray`, `slateBlue`, `green`, `violet`, `rose`, `orange`, `desert` + ### `getRanges` {@link "History Messages".GetRangesRequest} @@ -268,6 +268,27 @@ still reply with an {@link "History Messages".ActionResponse} when the action wa If multiple `id`s are sent, then present a modal window for confirmation, eventually responding to the message with {@link "History Messages".ActionResponse} +## Subscriptions + +### `onThemeUpdate` +- {@link "History Messages".OnThemeUpdateSubscription} +- Sends {@link "History Messages".OnThemeUpdateSubscribe} whenever the browser theme changes. +- For example: +```json +{ + "theme": "dark", + "themeVariant": "default" +} +``` +- Or, with a different theme variant: +```json +{ + "theme": "light", + "themeVariant": "violet" +} +``` +- Available theme variants: `default`, `coolGray`, `slateBlue`, `green`, `violet`, `rose`, `orange`, `desert` + ## Notifications ### `open` diff --git a/special-pages/pages/new-tab/messages/examples/widgets.js b/special-pages/pages/new-tab/messages/examples/widgets.js index 6f15fd5f8f..eb4721ed12 100644 --- a/special-pages/pages/new-tab/messages/examples/widgets.js +++ b/special-pages/pages/new-tab/messages/examples/widgets.js @@ -54,10 +54,6 @@ const initialSetupResponse = { userImages: [], userColor: null, background: { kind: 'default' }, - defaultStyles: { - lightBackgroundColor: '#E9EBEC', - darkBackgroundColor: '#27282A', - }, }, }; diff --git a/special-pages/pages/special-error/app/special-error.md b/special-pages/pages/special-error/app/special-error.md new file mode 100644 index 0000000000..b10291047c --- /dev/null +++ b/special-pages/pages/special-error/app/special-error.md @@ -0,0 +1,160 @@ +--- +title: Special Error Page +--- + +# Special Error Page + +Displays SSL certificate errors and malicious site warnings. + +## Requests + +### `initialSetup` +{@link "SpecialError Messages".InitialSetupRequest} + +Configure initial special error page settings. + +**Types:** +- Response: {@link "SpecialError Messages".InitialSetupResponse} + +Example for a phishing warning: + +```json +{ + "locale": "en", + "env": "production", + "platform": { + "name": "macos" + }, + "errorData": { + "kind": "phishing", + "url": "https://malicious-example.com" + }, + "theme": "light", + "themeVariant": "default" +} +``` + +Example for a malware warning: + +```json +{ + "locale": "en", + "env": "production", + "platform": { + "name": "windows" + }, + "errorData": { + "kind": "malware", + "url": "https://malware-example.com" + }, + "theme": "dark", + "themeVariant": "default" +} +``` + +Example for an SSL expired certificate error: + +```json +{ + "locale": "en", + "env": "production", + "platform": { + "name": "macos" + }, + "errorData": { + "kind": "ssl", + "errorType": "expired", + "domain": "expired.badssl.com" + }, + "theme": "light", + "themeVariant": "default" +} +``` + +Example for an SSL wrong host error: + +```json +{ + "locale": "en", + "env": "production", + "platform": { + "name": "macos" + }, + "errorData": { + "kind": "ssl", + "errorType": "wrongHost", + "domain": "wrong.host.badssl.com", + "eTldPlus1": "badssl.com" + }, + "theme": "light", + "themeVariant": "default" +} +``` + +### Error Data Types + +**Malicious Site** (`kind`: `phishing` | `malware` | `scam`): +- `kind`: Type of malicious site +- `url`: The URL of the malicious site + +**SSL Errors** (`kind`: `ssl`): +- `errorType`: One of `expired`, `invalid`, `selfSigned`, `wrongHost` +- `domain`: The domain with the certificate issue +- `eTldPlus1`: (Only for `wrongHost`) The eTLD+1 of the expected domain + +Available theme variants: `default`, `coolGray`, `slateBlue`, `green`, `violet`, `rose`, `orange`, `desert` + +## Subscriptions + +### `onThemeUpdate` +- {@link "SpecialError Messages".OnThemeUpdateSubscription} +- Sends {@link "SpecialError Messages".OnThemeUpdateSubscribe} whenever the browser theme changes. +- For example: +```json +{ + "theme": "dark", + "themeVariant": "default" +} +``` +- Or, with a different theme variant: +```json +{ + "theme": "light", + "themeVariant": "violet" +} +``` +- Available theme variants: `default`, `coolGray`, `slateBlue`, `green`, `violet`, `rose`, `orange`, `desert` + +## Notifications + +### `leaveSite` +- {@link "SpecialError Messages".LeaveSiteNotification} +- Sent when the user clicks the "Leave Site" or "Go Back" button to navigate away from the dangerous site. + +### `visitSite` +- {@link "SpecialError Messages".VisitSiteNotification} +- Sent when the user chooses to proceed to the site despite the warning. + +### `advancedInfo` +- {@link "SpecialError Messages".AdvancedInfoNotification} +- Sent when the user clicks the "Advanced" button to view more details about the error. + +### `reportInitException` +- {@link "SpecialError Messages".ReportInitExceptionNotification} +- Reports errors during page initialization. + +```json +{ + "message": "Failed to initialize special error page" +} +``` + +### `reportPageException` +- {@link "SpecialError Messages".ReportPageExceptionNotification} +- Reports errors during page operations. + +```json +{ + "message": "Failed to render error details" +} +``` diff --git a/typedoc.js b/typedoc.js index 0c8fc91555..3e74832331 100644 --- a/typedoc.js +++ b/typedoc.js @@ -6,6 +6,8 @@ const config = { projectDocuments: [ 'special-pages/pages/new-tab/app/new-tab.md', 'special-pages/pages/history/app/history.md', + 'special-pages/pages/special-error/app/special-error.md', + 'special-pages/pages/errorpage/app/errorpage.md', 'injected/docs/*.md', 'messaging/docs/messaging.md',