Bug 1859299 Comment 3 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

(In reply to Valentin Gosu [:valentin] (he/him) from comment #2)
> Great find, Julian. I think this is indeed a bug.
> Most likely this is originating for the meta refresh code in docshell:
> https://searchfox.org/mozilla-central/rev/0ba4632ee85679a1ccaf652df79c971fa7e9b9f7/docshell/base/nsDocShell.cpp#5212-5221
> ```cpp
> nsDocShell::ForceRefreshURI(nsIURI* aURI, nsIPrincipal* aPrincipal,
>                             uint32_t aDelay) {
>   NS_ENSURE_ARG(aURI);
> 
>   RefPtr<nsDocShellLoadState> loadState = new nsDocShellLoadState(aURI);
>   loadState->SetOriginalURI(mCurrentURI);
>   loadState->SetResultPrincipalURI(aURI);
>   loadState->SetResultPrincipalURIIsSome(true);
>   loadState->SetKeepResultPrincipalURIIfSet(true);
>   loadState->SetIsMetaRefresh(true);
> ```

Good to know! Just in case, as I was trying to understand if this was intentional or not, I stumbled on this comment: https://searchfox.org/mozilla-central/rev/0ba4632ee85679a1ccaf652df79c971fa7e9b9f7/docshell/base/nsDocShellLoadState.h#443-447. Not sure it's completely relevant here, but just in case:

```cpp
  // If a refresh is caused by http-equiv="refresh" we want to set
  // aResultPrincipalURI, but we do not want to overwrite the channel's
  // ResultPrincipalURI, if it has already been set on the channel by a protocol
  // handler.
  bool mKeepResultPrincipalURIIfSet;
```
(In reply to Valentin Gosu [:valentin] (he/him) from comment #2)
> Great find, Julian. I think this is indeed a bug.
> Most likely this is originating for the meta refresh code in docshell:
> https://searchfox.org/mozilla-central/rev/0ba4632ee85679a1ccaf652df79c971fa7e9b9f7/docshell/base/nsDocShell.cpp#5212-5221
> ```cpp
> nsDocShell::ForceRefreshURI(nsIURI* aURI, nsIPrincipal* aPrincipal,
>                             uint32_t aDelay) {
>   NS_ENSURE_ARG(aURI);
> 
>   RefPtr<nsDocShellLoadState> loadState = new nsDocShellLoadState(aURI);
>   loadState->SetOriginalURI(mCurrentURI);
>   loadState->SetResultPrincipalURI(aURI);
>   loadState->SetResultPrincipalURIIsSome(true);
>   loadState->SetKeepResultPrincipalURIIfSet(true);
>   loadState->SetIsMetaRefresh(true);
> ```

Good to know! Just in case, as I was trying to understand if this was intentional or not, I stumbled on this comment: https://searchfox.org/mozilla-central/rev/0ba4632ee85679a1ccaf652df79c971fa7e9b9f7/docshell/base/nsDocShellLoadState.h#443-447. Not sure it's completely relevant here, but just in case:

```cpp
  // If a refresh is caused by http-equiv="refresh" we want to set
  // aResultPrincipalURI, but we do not want to overwrite the channel's
  // ResultPrincipalURI, if it has already been set on the channel by a protocol
  // handler.
  bool mKeepResultPrincipalURIIfSet;
```

Edit: It seems this was introduced for Bug 1468523

Back to Bug 1859299 Comment 3