Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: duplicate navigation related APIs to contents.navigationHistory #41752

Merged
merged 12 commits into from
Jun 5, 2024
Prev Previous commit
Next Next commit
docs: add breaking change to 31
  • Loading branch information
alicelovescake committed Jun 4, 2024
commit 91d767aa9a3cbbf5606fcf359ba721b92c925694
4 changes: 2 additions & 2 deletions docs/api/navigation-history.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Returns `boolean` - Whether the browser can go forward to next web page.

* `offset` Integer

Returns `boolean` - Whether the web page can go to `offset`.
Returns `boolean` - Whether the web page can go to the specified `offset` from the current entry.

#### `navigationHistory.clear()`

Expand Down Expand Up @@ -60,7 +60,7 @@ Navigates browser to the specified absolute web page index.

* `offset` Integer

Navigates to the specified offset from the "current entry".
Navigates to the specified offset from the current entry.

#### `navigationHistory.length()`

Expand Down
26 changes: 26 additions & 0 deletions docs/breaking-changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,32 @@ See [crbug.com/332584706](https://issues.chromium.org/issues/332584706) for more

This brings the behavior to parity with Windows and Linux. Prior behavior: The first `flashFrame(true)` bounces the dock icon only once (using the [NSInformationalRequest](https://developer.apple.com/documentation/appkit/nsrequestuserattentiontype/nsinformationalrequest) level) and `flashFrame(false)` does nothing. New behavior: Flash continuously until `flashFrame(false)` is called. This uses the [NSCriticalRequest](https://developer.apple.com/documentation/appkit/nsrequestuserattentiontype/nscriticalrequest) level instead. To explicitly use `NSInformationalRequest` to cause a single dock icon bounce, it is still possible to use [`dock.bounce('informational')`](https://www.electronjs.org/docs/latest/api/dock#dockbouncetype-macos).

### Deprecated: `clearHistory`, `canGoBack`, `goBack`, `canGoForward`, `goForward`, `canGoToOffset`, `goToOffset` on `WebContents`

The navigation-related APIs are now deprecated.

These APIs have been moved to the `navigationHistory` property of `WebContents` to provide a more structured and intuitive interface for managing navigation history.

```js
// Deprecated
win.webContents.clearHistory()
win.webContents.canGoBack()
win.webContents.goBack()
win.webContents.canGoForward()
win.webContents.goForward()
win.webContents.canGoToOffset()
win.webContents.goToOffset(index)

// Replace with
win.webContents.navigationHistory.clear()
win.webContents.navigationHistory.canGoBack()
win.webContents.navigationHistory.goBack()
win.webContents.navigationHistory.canGoForward()
win.webContents.navigationHistory.goForward()
win.webContents.navigationHistory.canGoToOffset()
win.webContents.navigationHistory.goToOffset(index)
```

## Planned Breaking API Changes (30.0)

### Behavior Changed: cross-origin iframes now use Permission Policy to access features
Expand Down