Open Bug 1750185 Opened 3 years ago Updated 3 years ago

WebExtensions API: Transition field in history.VisitItem showing wrong value for some kinds of visits

Categories

(WebExtensions :: Untriaged, defect, P3)

Firefox 96
defect

Tracking

(firefox96 affected, firefox97 affected, firefox98 affected)

Tracking Status
firefox96 --- affected
firefox97 --- affected
firefox98 --- affected

People

(Reporter: jakewheat, Unassigned)

Details

Attachments

(4 files)

Attached file transitionbehaviour.js

This is not a high priority bug.

Transition field in history.VisitItem showing wrong value for some kinds of url navigation, maybe other issues.

Reference:
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/history/TransitionType

  1. When you refresh a page, you get the transition type for the previous visit, instead of 'refresh'. This is whether you use F5, or just press enter on the location bar (for pressing enter, it's arguably OK to use the transition type of 'typing', but the specification on the docs link says different).

  2. It appears that when you click a link on a page which links to that self-same page, you also get the transition type for the previous visit, instead of 'link'.

It's probably not the most important issue in Firefox. It's affecting some extension code I'm working on to provide an alternative tab/history manager.

Additional questionable stuff (that doesn't have a specification):

  1. When you click the forward and back buttons in the tab, you get the transition field of the previous visit, it makes more sense to me to have a tab-history transition type or something like that. 'Link' would at least be better than the previous transition type.

  2. When you click a link in the history sidebar, you get a transition type of 'link' which is also questionable.

These seem inconsistent with the (correctly working) transition type of 'auto_bookmark' which you get when you click on bookmarks.

Reproduction:

Put both attached files on a dir on your machine load manifest.json in the about:debugging#/runtime/this-firefox screen

click the inspect for this extension to get the console for it

open a new tab

enter "old.reddit.com", press enter

see in the console: "transition: typed"
as expected

press f5 on the old.reddit.com tab
see in the console: "transition: typed"
expected "transition: reload"

on the old.reddit.com tab, click the reddit logo at the top left which links to old.reddit.com (the same as the current page)
see in the console: "transition: typed"
expected "transition: link"

click on e.g. the comments link for the first item
see in the console: "transition: link"
as expected

press f5 on this tab
see in the console: "transition: link"
expected "transition: reload"

you can also click the history variations to see the transitions in these cases

manifest.json if I can't figure out how to attach a second file:

{
"manifest_version": 2,
"name": "transitionbehaviour",
"version": "1.0",
"permissions": [
"tabs",
"history"
],
"background": {
"scripts": ["transitionbehaviour.js"]
}
}

Attached file manifest.json

I noticed that you can see the reload transition when you wait a while, then go back to the browser and press f5.
Once it's in this state, it appears to work pressing f5 (repeatedly) on any tab - it keeps giving the transition as reload.

But if you press enter on the location bar on one of these tabs which started giving reload transitions, it gives transtition:typed, and then if you press f5 after this, the f5 refresh goes back to giving transition typed again - it goes back to giving the wrong transition. I didn't find a way to reproduce getting the reload transition reliably, only by waiting several minutes (roughly, maybe up to 30 minutes or something), without the browser focused.

The Bugbug bot thinks this bug should belong to the 'WebExtensions::Untriaged' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: General → Untriaged
Product: Firefox → WebExtensions

Hello,

I could not properly reproduce the issue as once I load the manifest.json file as instructed, I get an error in the extension toolbox console.

Now I’m not completely sure this error causes the improper reproduction of the issue, but when proceeding with the steps to reproduce, each action logs only “transition: link” in the extension console.

For further details, see the attached screenshot.

Tested on the latest Nightly (98.0a1/20220116095124) and Release (96.0.1/20220113185450) under Windows 10 x64.

Attached image 2022-01-17_09h07_26.png

I retried on a fresh browser install and got what you saw. I think you get what I put in the original report, when you load the extension a second time. What you see and documented in your screenshot is still incorrect in more or less the same way?

Hello,

I managed to reproduce the issue based on the instructions from Comment 6.

The issue was reproduced as mentioned in the steps to reproduce of Comment 0 on the latest Nightly (98.0a1/20220118215506), Beta (97.0b5/20220118185733) and Release (96.0.1/20220113185450) under Windows 10 x64.

For further details, see the attached screenshot.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Attached image 2022-01-19_10h20_30.png
Severity: -- → S3
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: