Closed Bug 1755547 Opened 4 years ago Closed 2 years ago

LoadType not set on SessionHistoryInfo when handling `pushState`.

Categories

(Core :: DOM: Navigation, defect)

defect

Tracking

()

RESOLVED INVALID

People

(Reporter: mconley, Unassigned)

Details

STR:

  1. Visit Google Calendar
  2. Click on any event such that the event popup bubble appears, and a new SHEntry is created (via pushState)
  3. Open the Browser Console
  4. Execute this:
let count = gBrowser.selectedBrowser.browsingContext.sessionHistory.count;
let entry = gBrowser.selectedBrowser.browsingContext.sessionHistory.getEntryAtIndex(count - 1);
entry.loadType

ER:

The emitted load type should be 8, since this history entry was created via pushState.

AR:

The emitted load type is 0.

It seems that when we construct the SessionHistoryInfo for the pushState here: https://searchfox.org/mozilla-central/rev/679ebe4ffdc7312e42d55badb02ef89336af8223/docshell/base/nsDocShell.cpp#11881

the constructor that we're using doesn't take a loadType, so we fall back to the default of 0: https://searchfox.org/mozilla-central/rev/679ebe4ffdc7312e42d55badb02ef89336af8223/docshell/shistory/SessionHistoryEntry.h#162

Hey Peter, do we expect the load type to be passed up in this case? If so, do you think it should be accepted as part of the constructor being used at https://searchfox.org/mozilla-central/rev/679ebe4ffdc7312e42d55badb02ef89336af8223/docshell/shistory/SessionHistoryEntry.h#45, or should we add a SetLoadType method?

Flags: needinfo?(peterv)

I don't think we've ever set it to anything but 0 or LOAD_HISTORY in the old implementation. Why do you need to know this?

Flags: needinfo?(peterv)

Oh, and as smaug pointed out some of the LOAD_RELOAD* values.

And use of nsISHEntry.loadType can be quite surprising since it depends on the most recent load the entry was used for.
https://searchfox.org/mozilla-central/rev/be4604e4be8c71b3c1dbff2398a5b05f15411673/docshell/shistory/nsISHEntry.idl#133-137 kind of hints about that.

NI Mike for comment 2.

Flags: needinfo?(mconley)

Oh, I see... so the loadType on an nsISHEntry is not some kind of indication of what loadType was on the nsIDocShell when this nsISHEntry was last loaded?

If that's the case, then sure, I guess this is an INVALID bug... I guess I find loadType's meaning in the context of nsISHEntry kind of confusing then.

Flags: needinfo?(mconley) → needinfo?(peterv)
Severity: -- → S3

Going to close per comment 6. Please feel free to correct me if I got this wrong.

Status: NEW → RESOLVED
Closed: 2 years ago
Flags: needinfo?(peterv)
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.