Safari Web Extensions: browser.webNavigation.getAllFrames by tabId return empty string url, when url is in blob protocol

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).

Our engineering teams need to investigate this issue, as resolution may involve changes to Apple's software. I'd greatly appreciate it if you could open a bug report and post the FB number here once you do. Bug Reporting: How and Why? has tips on creating your bug report.

FB15886165

Safari Web Extensions: browser.webNavigation.getAllFrames by tabId return empty string url, when url is in blob protocol
 
 
Q