Safari handles tabs created by app extensions and web extensions differently

Feedback ID: FB8176693

Hello,

I have reported this before, but just noticed the behaviour is different in web extensions.

Have an web extension create a new tab to open an HTML page inside the extension resources:

Code Block javascript
browser.tabs.create({'url': browser.runtime.getURL("test.html") + '?p1=test&p2=test2' });


Now the equivalent in an app extension:

Code Block swift
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: "p1", value: "test"),
URLQueryItem(name: "p2", value: "test2"),
];
activeWindow?.openTab(with: (urlComponents?.url)!, makeActiveIfPossible: true, completionHandler: {_ in
});
}
}


After the tab is created notice its URL, eg.:

safari-extension://2CB967-22BA-44F3-B604-72611F/aafefbf/test.html?p1=test&p2=test2



Now, restart Safari.

Expected:
  • Restored tab shows the same url (minus the baseURL which has been updated)

Actual:
  • The tab created by the Safari app extension shows the updated baseURI without any parameters. Eg.:

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

  • The tab created by the Safari web extension shows the full url as expected


Considering this is affecting a great number of my users and renders the extension pretty useless, I am wondering if there are any realistic plans to fix this?

Moving to web extension might be very problematic as the extension requires access to all pages the user accesses and since most users are not very tech savvy it will be quite hard to guide them through the new permission prompts.

Thank you