Closed Bug 1663274 Opened 5 years ago Closed 5 years ago

webRequest.onResponseStarted doesn't fire for main_frame when navigating through browser history

Categories

(WebExtensions :: Request Handling, defect)

80 Branch
defect

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: mad1ost, Unassigned)

Details

Attachments

(1 file)

602 bytes, application/x-zip-compressed
Details

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0

Steps to reproduce:

webRequest.onResponseStarted event doesn't fire for types 'main_frame' when moving through browser history (by pressing back and forward buttons)

Expected results:

I expect that the event to be fired for main_frame, but it only fires for a favicon requests (*.ico)

Component: Untriaged → Request Handling
Product: Firefox → WebExtensions

Hello,

In order to properly reproduce the issue and confirm your findings, could you please attach the extension you used to uncover this issue?

Thank you !

Flags: needinfo?(mad1ost)
Flags: needinfo?(mad1ost)

If the page is eligible, the page is frozen, and a navigationg between history entries would restore the previously frozen version of the page instead of triggering a new request. This feature is called the "bfcache" (for "Back-Forward Cache") and documented at https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/1.5/Using_Firefox_1.5_caching . It's not Firefox-only: https://developers.google.com/web/updates/2019/02/back-forward-cache

This is working as intended.

Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Resolution: --- → INVALID

I can also confirm this. But if this is working as expected then this is not a bug.

But how to determine if the page was loaded from the bfcache or not? Which API should I use?

(In reply to Tomislav Jovanovic :zombie from comment #7)

You probably want https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webNavigation anyway.

Unfortunately webNavigation API doesn't answer this question. TransitionQualifier "forward_back" is presented even if the page was not loaded from the bfcache.

If you really want to know whether a page was restored from the bfcache opposed to a fresh load, then the pageshow event has a persisted property that tells whether the page load was fresh or restored from the bfcache - https://developer.mozilla.org/en-US/docs/Web/API/PageTransitionEvent/persisted

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: