Safari Extension content_scripts may not run on some devices

I have found two Safari Extension issues that reproduce on iPad 6th generation and not on iPad 8th generation. Have any of these events been reported?

1. content_scripts is not executed immediately after Safari is launched

After closing Safari, the content_scripts that the Safari Extension is supposed to execute in the Safari tab immediately after startup are not working. In our app, we are using background's webNavigation.onDOMContentLoaded to run as content_scripts. We are reproducing this issue about 50% of the time. 2.

2. sendNativeMessage response is not returned

The following code sends a message from the Safari Extension to the application, but sometimes neither response nor error is output.

browser.runtime.sendNativeMessage('application.id, {})
  .then((response) => { console.log(response) })
  .catch((error) => { console.error(error) })

This problem reproduces about 5~10% of the time.

Replies

"1. content_scripts is not executed immediately after Safari is launched" was incorrect.

While debugging, we found that sometimes the User Agent is different, which causes the code that controls the behavior of content_scripts to malfunction.

Usually, it worked correctly here. "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.2 Safari/605.1.15 "

I sometimes get a different UA than usual right after starting Safari. "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.2 Mobile/15E148 Safari/604.1"