I feel like this should be a pretty common problem with a pretty simple answer, but has anyone encountered a problem where your app's widget is not available on a device where you've been testing a dev version of your app as well as installing the App Store version? So what I mean is, on my iPhone, I'm often testing daily builds of our app, and I'm also installing our app from the App Store. At some point, this combo results in our app's widget being unavailable in the list of widgets on my iPhone. I've tried uninstalling dev builds, App Store releases, and so on, but the widget never comes back on a new install. Looking for a magic combo here, I guess, to clear some mystery widget registry or something.
Post
Replies
Boosts
Views
Activity
After porting my Chrome extension to Safari Web Extension, I'm left with one final mystery. My toolbar icon has a popup, and that popup has an X button in the top right for the user to be able to close it. When clicked, this works on Chrome/Firefox/Edge to close it:
window.close()
On Safari, however, I get an uncatchable warning:
⚠️ Can't close the window since it was not opened by JavaScript.
In the old days, we had to do this on Safari:
safari.extension.popovers[0].hide();
But that doesn't seem to be an option now. I'm assuming I need to delegate to the native app portion of the extension to close the popup, but I can't find any documentation on how to get a handle to the popup from NSExtensionRequestHandling. I can get a message to it using the nativeMessaging permissions and:
browser.runtime.sendNativeMessage("ignored", {
	message: "CLOSE_POPUP"
})
...but once in the native app handler, I'm not sure what to do next. Any ideas?
Safari Version 14.0.1 (16610.2.11.51.8)
I am porting a Chrome/Firefox/Edge extension to Safari Web Extension. Mostly, the process was painless, I am, however, seeing quite different behavior in the tab ids generated by Safari compared to Chrome, Firefox, and Edge. My extension has callbacks for each of these browser.webNavigation events:
browser.webNavigation.onBeforeNavigate
browser.webNavigation.onCommitted
browser.webNavigation.onDOMContentLoaded
In each of these I rely on the tab id for various future tab targeting operations. When opening a new tab, the details object passed to each of these callbacks has a non-zero tabId on Chrome, Firefox, and Edge. However, in Safari, the tabId is always zero. To debug, I added one more callback:
browser.webNavigation.onCompleted
At this point Safari finally has a non-zero tabId in the details param. Needless to say this is causing some consternation with achieving the same outcomes as tab tracking on Chrome, Firefox, and Edge. It's like Safari is treating new tabs as "non tabs" until navigation completes. You can even see it when trying to get the tab by tabId=0:
browser.tabs.get(tabId) // tabId=0 here
	.then(tab => {
		// tab is undefined
	});
Seems like this might be a bug. I can't imagine why the behavior is so different from other browsers. Any ideas on how to work around?