Verified Commit 43429bce authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame Committed by Richard Pospesel
Browse files

fixup! Bug 21952: Implement Onion-Location

Keep fragments in redirects, to fix #34366
parent 3dc963cb
......@@ -4,6 +4,8 @@
var EXPORTED_SYMBOLS = ["OnionLocationChild"];
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
class OnionLocationChild extends JSWindowActorChild {
handleEvent(event) {
this.onPageShow(event);
......@@ -23,9 +25,16 @@ class OnionLocationChild extends JSWindowActorChild {
if (aMessage.name == "OnionLocation:Refresh") {
const doc = this.document;
const docShell = this.docShell;
const onionLocationURI = doc.onionLocationURI;
let onionLocationURI = doc.onionLocationURI;
const refreshURI = docShell.QueryInterface(Ci.nsIRefreshURI);
if (onionLocationURI && refreshURI) {
const docUrl = new URL(doc.URL);
let onionUrl = new URL(onionLocationURI.asciiSpec);
// Keep consistent with Location
if (!onionUrl.hash && docUrl.hash) {
onionUrl.hash = docUrl.hash;
onionLocationURI = Services.io.newURI(onionUrl.toString());
}
refreshURI.refreshURI(
onionLocationURI,
doc.nodePrincipal,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment