Hello.
Environment
Safari version 18.1 (22B81).
Problem
In my Safari Web Extension i need to determine the url of the active tab.
I do it this way:
const onError = (error) => {
console.error(error);
};
const getFrameUrl = async (frames) => {
console.info(frames)
};
const getAllFrames = (frames) => {
browser.webNavigation.getAllFrames({ tabId: frames[0].id }).then(getFrameUrl, onError);
};
browser.tabs.onUpdated.addListener(() => {
browser.tabs.query({ currentWindow: true, active: true }).then(getAllFrames, onError);
});
The problem is that if the tab url is a link in the blob protocol, then the result function browser.webNavigation.getAllFrames({ tabId: tabs[0].id }) is as follows:
{frameId: 0, parentFrameId: -1, url: "", errorOccurred: false}
In Safari version 17 the correct URL value was returned:
{frameId: 0, parentFrameId: -1, url: "blob://<some id>", errorOccurred: false}
How can I fix the problem?
Environment
Safari version 18.1 (22B81).