Unexpected(?) behaviour when loading an extension's internal URL

FB7597364 (attached video there)

Hello,

I have filled a radar but I'm wondering if I am misunderstanding the following (Safari TP 104+):


  1. Make the extension open a new tab with the baseURI and a parameter, eg.:

safari-extension://2CB967-22BA-44F3-B604-72611F/aafefbf/test.html?title=Apple&color=red



Here's the code I'm using:
Code Block
SFSafariApplication.getActiveWindow { activeWindow in
SFSafariExtension.getBaseURI { baseURI in
guard let baseURI = baseURI else { return }
var urlComponents = URLComponents(string: baseURI.appendingPathComponent("test.html").absoluteString);
urlComponents?.queryItems = [
URLQueryItem(name: "title", value: "Apple"),
URLQueryItem(name: "color", value: "red"),
];
activeWindow?.openTab(with: (urlComponents?.url)!, makeActiveIfPossible: true, completionHandler: {_ in });
}
}



2. Wait for the page to load
3. Quit Safari
4. Open Safari

Expected:
  • Safari updates the baseURL of that tab and keeps the query parameters, eg:

safari-extension://11111-new-baseURI-44F3-B604-72611F/o213s/test.html?title=Apple&color=red



Actual:
  • Safari updates the baseURL of that tab and strips the query parameters, eg:

safari-extension://11111-new-baseURI-44F3-B604-72611F/o213s/test.html




Accepted Reply

The query stripping is a bug.

Replies

The base URI of extensions change between launches to avoid websites fingerprinting users. Thanks for the feedback and sample code, we will look into it!
Right, I am aware of the reasoning and I (sort of) agree with it. My question is the unexpected behaviour.

Safari changes the baseURI of the extensions on launch. If there are any extension internal pages open, eg.: safari-extensions://1234-1234-123-1233/ it will reload the tab with the new baseURI.

My question is if stripping the query parameters from those internal pages, expected or a bug.


Thank you
The query stripping is a bug.
Got it, thank you!
I obviously understand bugs are not fixed immediately but considering 110 just came out and the issue persists, is there any way to actively track this bug in case I need to provide more feedback? I noticed my original feedback ID was never updated despite actually being partly implemented.

I am just concerned it will go unfixed by the time Safari 14 comes out of beta
Hello,

Any update on this bug?

Thank you

This still seems to be happening as of iOS 16.1.

What's the status of the radar bug tracking this issue?