I was able to come across a solution for this. In my safari browser I was seeing the error message.
Failed to load resource: You do not have permission to access the requested resource.
The problem was in the changes I made in an attempt to fix errors I was seeing in the Safari settings under my extension (errors such as - "Failed to load images in default_icon for the browser_action or page_action manifest entry.", "Failed to load images in icons manifest entry.", "The service_worker script failed to load due to an error").
So I changed some paths in my manifest.json and got ride of those errors. Without realizing, those changes screwed up the way I was trying to load my web_accessible_resources via chrome.runtime.getURL.
Here is my web_accessible_resources section in my manifest.json.
.
.
"web_accessible_resources": [
{
"resources": ["dist/panel.html", "dist/iframeListener.bundle.js"],
"matches": ["<all_urls>"]
}
]
.
.
Here's how I was calling it in my logic
private initPanel(): HTMLIFrameElement {
.
.
.
// wrong
iframeReference.src = chrome.runtime.getURL("panel.html");
.
.
.
}
Here's how I fixed it
private initPanel(): HTMLIFrameElement {
.
.
.
iframeReference.src = chrome.runtime.getURL("dist/panel.html");
.
.
.
}
These changes are great but temporary - ideally I shouldn't need to change paths in my manifest.json to get this working for safari. As part of my build process I generate a "dist" directory which includes a copy of my manifest.json this is the manfest.json that Xcode should be picking up thereby allowing chrome.runtime.getURL("panel.html"); to work. But Xcode picks up the wrong manifest.json (the one in my projects root folder) so I am manually prepending "dist/" to my paths in this manifest. I think I need to modify some setting in Xcode so that it picks up the right manifest. I am just not familiar with Xcode so I'm working through it.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: