Hi, I am developing the Click & Read web add-on for Chromium, Firefox and Safari.
We use xcrun safari-web-extension-converter tool to generate the Safari add-on. The build on Xcode had no meaning errors/warnings, until we had to switch to a more up-to-date MacBook (required as deprecated Mac had no support for latest macOS and thus for Xcode compatibility !).
So now I build my add-on on an Apple M1 MB Air on Sequoia 15.0 with latest Xcode, but I encounter an error ? or warning ? :
NSBundle file:///System/Library/PrivateFrameworks/MetalTools.framework/ principal class is nil because all fallbacks have failed
Unable to create bundle at URL ((null)): normalized URL null
Unable to create bundle at URL ((null)): normalized URL null
Unable to create bundle at URL ((null)): normalized URL null
But it doesn't prevent the add-on build to complete as I am able to open it onto Safari. Then, when loading the add-on on a test web page, I get this error on safari console:
Error: Invalid call to runtime.connect(). No runtime.onConnect listeners found.
BTW, the same add-on Dist works as expected on Chrome or Firefox (on macOS).
So it seems the runtime listener runtime.onConnect.addListener isn't initiated on Background script...
Thanks for your feedback and help
Safari Developer Tools
RSS for tagInspect, edit, debug, and check the performance of your web content using Safari developer tools.
Posts under Safari Developer Tools tag
55 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
Dependent fields for multi-select options and dropdown fields are not displaying in Safari, although they work correctly in Chrome and Firefox.
Scenario
You have a form built with ASP.NET and Razor, where users need to select multiple options from a dropdown list to trigger the display of dependent fields.
Multi-Select Dropdown: The form has a multi-select dropdown for choosing different categories (Category A, Category B, etc.).
Dependent Fields: Based on the user's selection, certain dependent fields should become visible. For example, if the user selects Category A, an additional input field titled "Details for Category A" should be shown.
Expected Behavior (Chrome & Firefox)
When the user selects Category A or Category B, the corresponding input fields are displayed dynamically, functioning as expected.
Issue in Safari :
In Safari, the dependent fields do not show up when a user selects any category. It's as if the JavaScript or the CSS responsible for displaying these fields is not executing correctly.
CHROME
SAFARI
Browser: Safari (Version 18.0 (20619.1.26.31.6))
Operating System: MacOS (sequoia 15.0)
Device: MacBook Pro 14 Inch Apple M3 Pro , iPhone 14 iOS 18.0
declarativeNetRequest.getMatchedRules() gives us the below error:
Error retrieving tabs or matched rules: – Error: Invalid call to declarativeNetRequest.getMatchedRules(). The 'activeTab' permission has not been granted by the user for the tab.
We have added the "activeTab" permissions in the manifest (version 2). And in the device Safari extension settings we see that user has given permission as "allow".
Firefox and Chrome provide various options and services to set up browser characteristics while testing. These can be used with Selenium while setting up the driver.
An example with Firefox is setting a custom user agent and a download directory different than the default. Using Python:
from selenium.webdriver.firefox.options import \
Options as FirefoxOptions
from selenium.webdriver.firefox.service import \
Service as FirefoxService
firefox_options = FirefoxOptions()
# set up user agent
user_agent = UserAgent().get_user_agent()
firefox_options.set_preference("general.useragent.override", user_agent)
# set alternate download location
firefox_options.set_preference('browser.download.folderList', 2)
firefox_options.set_preference('browser.download.dir', download_dir_path)
Many of these browser-specific options and services are listed at Selenium's website under Supported Browsers.
However, Safari's information is very limited. On Selenium's site, for example, they list how to turn on Safari's limited logging: service = webdriver.SafariService(service_args=["--diagnose"]). Then, they point us to About WebDriver for Safari - which shows automaticInspection and automaticProfiling. The page primarily describes security features for testing with Safari.
In a regular user session, one can configure an alternate download directory, set a custom profile with specific settings for that profile, and so on. And, in the Developer Menu I can set some of these items manually for a given session (user agent, for example).
How can I access these features within Safari for use in automated web testing with Selenium?
Edit: Alternatively, does Apple have, or recommend, a different automated testing package for Safari?
Hi everyone,
I’m working on an iOS app using WKWebView, and I have a specific use case involving cross-origin iframes and form autofill. I’m wondering if it’s possible to programmatically fill input elements, such as credit card numbers, within a cross-origin iframe loaded in a WKWebView.
I understand that due to the Same-Origin Policy, direct DOM manipulation of cross-origin iframes is restricted. However, I’m curious if there are any methods or workarounds that might allow me to achieve this, specifically within the context of WKWebView. Thanks.
Hello there,
We are having a problem when trying to repdorucir videos with videojs in a webview on devices with iOS older than 17.4. When playing them you see that the player restarts several times until crashing the webview. This are the xcode logs when this happens:
Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)" UserInfo={NSLocalizedFailureReason=(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)}>
0x114029980 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'WebKit Media Playback' for process with PID=64167, error: Error Domain=RBSServiceErrorDomain Code=1 "(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)" UserInfo={NSLocalizedFailureReason=(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)}
0x1140180c0 - [PID=64164] WebProcessProxy::didClose: (web process 0 crash)
0x1140180c0 - [PID=64164] WebProcessProxy::processDidTerminateOrFailedToLaunch: reason=Crash
Unable to create a cookie using WebKit API or manually create a cookie in Safari with SameSite=None on a device using iPadOS 18 beta. In Safari, the None option is still in the drop down as a selection for SameSite which leads me to believe this is a bug. Is this going to be fixed in the release version of iOS 18?
If you create a cookie and add to the WKWebViewConfiguration the completionHandler returns 'Cookies synced' suggesting cookie was added with success. However, upon inspection of app in Safari the cookie is not there. This is broken in iOS 18 beta and works in previous versions without issue. Did Apple change the WKWebView API and break this feature?
code snippet:
NSDictionary* settings = self.commandDelegate.settings;
WKWebViewConfiguration* configuration = [self createConfigurationFromSettings:settings];
configuration.userContentController = userContentController;
NSMutableDictionary *cookieProperties = [NSMutableDictionary dictionary];
[cookieProperties setObject:@"foo" forKey:NSHTTPCookieName];
[cookieProperties setObject:@"bar" forKey:NSHTTPCookieValue];
[cookieProperties setObject:@"mydomain.com" forKey:NSHTTPCookieDomain];
[cookieProperties setObject:@"mydomain.com" forKey:NSHTTPCookieOriginURL];
[cookieProperties setObject:@"/" forKey:NSHTTPCookiePath];
NSHTTPCookie *cookie = [NSHTTPCookie cookieWithProperties:cookieProperties];
[configuration.websiteDataStore.httpCookieStore setCookie:cookie completionHandler:^{NSLog(@"Cookies synced");}];
WKWebView* wkWebView = [[WKWebView alloc] initWithFrame:self.engineWebView.frame configuration:configuration];
When we activate the developer options and right-click to select "Inspect," then navigate to the Network tab, we can view the request entries.
However, upon clicking on an entry, I can see the headers, cookies, and other details, but one crucial aspect is absent: the request and response data. This seems like a fundamental feature—why is it missing? 🤔
Hi, I'm experiencing an issue with my Safari extension on iOS 18. When trying to access images using browser.runtime.getURL(), it doesn't work as expected. The same code works on iOS 17 and earlier versions. Here's my manifest file and code snippet.
"web_accessible_resources": [
{
"resources": [
"html/*.html",
"images/*.png",
"images/*.gif",
"images/*.svg",
"json/*.json",
"fonts/*.ttf",
"css/*.css"
],
"matches": [
"<all_urls>"
]
},
"images/fs_loading.svg",
"images/status_protected.svg",
"images/safe_check_icon.svg"
]
`var status_ok_svg = browser.runtime.getURL("images/status_protected.svg");`
Note: Image all are added in Images folder only
Is there a way to detect if the user has tapped on "Turn Off Content Blockers" option on safari in ios or get a callback from the same?
Hi everyone, when My project (Angular 5) running in Safari Browser, we have a download function, it's download the excel file, end with .xlsx, but when running in low version Safari version, it will have a popup, that is not my project did, it blocked be safari itself, you can check the image, my question is how to hide the 'View' button or directly download instead of show the popup?
We have implemented content blocking using Safari web extension, it blocks the content but after reloading the current page about 3-4 times the blocked content re-appears, how can we fix this issue?
Hi everyone I need a help I am using navigator.vibrate(50) for vibration but the issue is that vibration is working on android but not on ios/apple device and I am using react js Who knows what? Please help me.
the downloads button in safari keeps flickering and cannot be pressed no matter what.
Problem Details :
In the case of iOS, the image to be displayed in the pop-up message within the TypeScript application does not appear during file download.
An error occurred trying to load the resource when attempting to fetch the image (in the case of Safari).
The image does not appear in Edge or Chrome either, besides Safari. The image is displayed correctly on Windows 10, 11, Mac Ventura, Mac Sonoma, and Android.
Neither svg format nor png format images are displayed.
Only in the case of iOS, a download modal appears in Safari (In Edge and Chrome, a different display asking whether or not to download appears, which is different from the modal).
The issue only occurs when the download modal display and the image fetching for the pop-up are conducted simultaneously. If you delay the display of the download modal from the timing of fetching the image for the pop-up (apply a wait), the image can be fetched.
Verification Environment:
iOS v.17.5.1 Safari 604.1
iOS v.17.3 Safari 604.1
IOS v.17.4.1 Chrome 126.0.6478.54
IOS v.17.4.1 Edge: 125.0.2535.72
Consideration and Request:
Based on the problem details, I am considering that this issue might be a bug in iOS.
I would like to know from experts whether this event is a bug or a specification of iOS.
If there is any information about similar events occurring, I would like to know.
If there are any solutions, hints, or advice, I would appreciate it if you could provide them.
If additional information is required from me, I would like to be contacted.
Thank you for your cooperation.
This method does not seem to work consistently: SFSafariViewControllerDelegate.safariViewController(_ controller: SFSafariViewController, initialLoadDidRedirectTo URL: URL)
It was working 100% of the time until this week for me, now it has about a 1-5% success rate for detecting redirects.
The docs are not clear:
@discussion This method may be called even after -safariViewController:didCompleteInitialLoad: if
the web page performs additional redirects without user interaction.
Code snippet from calling UIViewController that conforms to SFSafariViewControllerDelegate:
let config = SafariViewController.Configuration()
config.entersReaderIfAvailable = false
let vc = SFSafariViewController(url: url, configuration: config)
vc.delegate = self
self.safariViewController = vc
print(self.safariViewController?.delegate)
self.present(vc, animated: true)
Did something change? How can I make this consistent again?
For some reason, not all of the time but most of the time, the SFSafariViewControllerDelegate method for initialLoadDidRedirectTo is not being triggered for subsequent reloads as specified in the docs.
@discussion This method may be called even after -safariViewController:didCompleteInitialLoad: if
the web page performs additional redirects without user interaction.
I am allowing a user to log in with an OAuth 2.0 Provider on the Safari browser and expecting to detect the redirect to continue the flow from the app once their credentials have securely been consumed by the IdP in Safari.
It was working consistently. It went from a 100% success rate up until this week to maybe 1/20 successful redirects.
Code snippet:
let config = SafariViewController.Configuration()
config.entersReaderIfAvailable = false
let vc = SFSafariViewController(url: url, configuration: config)
vc.delegate = self
self.safariViewController = vc
print(self.safariViewController?.delegate)
self.present(vc, animated: true)
Why is it not always detecting the redirects?
If you write about multiple lines when entering code into the prompt, it will be open, but there is no way to check the topmost written code.
It does not expose 1 to 3 lines, nor does it provide scrolling.
I think it should work like Google Chrome or there should be a way to solve this within safari.
If there's any way I don't know, please help.
Ever since 17.4.1 updates to Safari, we are unable to debug our web applications using Safari. Was working perfectly fine before.
Safari shows "No Inspectable Applications" in the Develop -> iPadName menu. We have 3 target iPads (Mini, Air and gen 10) and one iPhone 13 Pro Max, all on iPadOS and iOS 17.4.1, all of them show "No Inspectable Applications" in the menu. iPad Mini and iPhone were both visible fine before the 17.4.1 update. Other devices were already updated automagically to 17.4.1 so we couldn't check the before - after scenario. Safari running on iPad simulator with XCode 15.2 has same behaviour.
We tried debugging with latest version of following MacOS:
MacOS Sonoma (Macbook Pro M2)
MacOS Sonoma (Mac Mini M1)
MacOS Ventura (Macbook Pro i9)
All of those have same behaviour: "No Inspectable Applications".
We tried Safari Tech Preview and iPadOS 17.5 beta 2 and no change.
Are we missing something?