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
34 changes: 34 additions & 0 deletions special-pages/pages/errorpage/app/errorpage.md
Original file line number Diff line number Diff line change
@@ -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`
37 changes: 29 additions & 8 deletions special-pages/pages/history/app/history.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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}

Expand Down Expand Up @@ -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`
Expand Down
4 changes: 0 additions & 4 deletions special-pages/pages/new-tab/messages/examples/widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ const initialSetupResponse = {
userImages: [],
userColor: null,
background: { kind: 'default' },
defaultStyles: {
lightBackgroundColor: '#E9EBEC',
darkBackgroundColor: '#27282A',
},
},
};

Expand Down
160 changes: 160 additions & 0 deletions special-pages/pages/special-error/app/special-error.md
Original file line number Diff line number Diff line change
@@ -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"
}
```
2 changes: 2 additions & 0 deletions typedoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',

Expand Down
Loading