[tbb-dev] Fwd: Changes to how protocol handlers work with the LOAD_REPLACE flag
tom at ritter.vg
Wed Jul 5 14:04:18 UTC 2017
May be relevant
---------- Forwarded message ----------
From: Honza Bambas <hbambas at mozilla.com>
Date: 5 July 2017 at 06:16
Subject: Changes to how protocol handlers work with the LOAD_REPLACE flag
To: "dev-platform at lists.mozilla.org" <dev-platform at lists.mozilla.org>,
Firefox Dev <firefox-dev at mozilla.org>
tl;dr: protocol handlers no longer set the LOAD_REPLACE flag, instead
set loadInfo.resultPrincipalURI to channel.URI to change the address
bar displayed URL.
More details in bug 1319111 .
In a bit more details - state BEFORE:
- The URL used for the result principal of the document (and shown in
the address bar) was channel.originalURI, unless LOAD_REPLACE was set.
Then it was channel.URI. Protocol handlers that wanted to affect this
URL needed to set channel.URI appropriately and set the LOAD_REPLACE
- If a protocol handler was delegating to another ("inner") protocol
handler and wanted to revert the URI override, it removed the
LOAD_REPLACE flag from the resulting channel.
- To have a URL other than channel.originalURI show in the address bar
and get used for the channel principal, a protocol handler sets
loadInfo.resultPrincipalURI to that URL.
- If a protocol handler is delegating to another ("inner") protocol
handler and wants to revert the URI override, it must save
loadInfo.resultPrincipalURI before and then restore it after the
"inner" protocol handler created the result channel.
- During HTTP redirects, if the target protocol handler does not set
loadInfo.resultPrincipalURI to a non-null value while creating the
channel, it will be set to the redirect target URI.
What has NOT CHANGED:
- LOAD_REPLACE is still set on channels that have been redirected by a
30X HTTP response from a server or have been internally redirected
(subject to change in a followup bug) or are part of a multi-part
- originalURI of an HTTP-redirected channel is changed to the first
URL in the whole redirect chain AFTER all redirect veto checks
- channel.originalURI is used for the address bar and security checks
by default when loadInfo.resultPrincipalURI is is left null (similarly
to as when LOAD_REPLACE flag was not set).
PS: Many thanks to Boris Zbarsky for his great help with this effort :)
dev-platform mailing list
dev-platform at lists.mozilla.org
More information about the tbb-dev