Good question. Yes and no. A web contents can be navigated. A page cannot*.Web contents will have the 'primary page changed' for each navigation. That is the recommended way to listen for navigations for primary frame in the WebContentsObserver now.There is a SUPER common pattern (we use it all over the place in PWA code) where someone wants to calculate something on a WebContents, and the basically send the results of that to something else to do something with it (or just store it for reference). But then, it implements all of the navigation listening code to 'clear' that value and recalculate it on the next navigation complete. Even more - it'll often listen to WebContentsDestroyed with is a classic source of bugs (and a presubmit compliains about that).Instead, you can make a PageUserData to store something on a page object itself. This is super great, as it's compatible with BFCache and prerendering (if you want it to be). Any calculations are saved etc. Destruction of the page removes the data. hooray! However - there isn't a way for a PageUserData to listen to its own lifecycle in a simple way. We have code that executes after a page becomes active, and then I want to 'stop' if it enters bfcache.On Tue, Dec 9, 2025 at 9:37 AM Sidhin Thomas <sidhin...@gmail.com> wrote:I have a maybe dumb question, isn't Page == Webcontents in context of the browser?On Tue, Dec 9, 2025 at 11:00 PM Daniel Murphy <dmu...@chromium.org> wrote:There is an observer for this on WebContentsObserver - but we shouldn't need a whole webcontents - we should be able to just observe this on a page.--On Mon, Dec 8, 2025 at 4:00 PM Daniel Murphy <dmu...@chromium.org> wrote:Do we have anything like this? It would be super useful for me to decouple code from the WebContents - as I want to cancel operations when a page goes to kPendingDeletion, and pause it if it goes to kInBackForwardCache.Dan
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/CA%2B4qT30hDh5gbgQm%3DntnOPj8LJsYL4E6CEnqZ3uFYpL%2B7%2BU%2BZw%40mail.gmail.com.
As per suggestion by dcheng, +content-owners to see if anyone is thinking about stuff like this.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+unsubscribe@chromium.org.
--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+unsubscribe@chromium.org.