Hi folks,
We're building a Safari web extension and experiencing an issue to see it among extensions in Safari after installing the container app to /Applications and launching it.
The app and extension is notarized and signed with Developer ID
After an extensive investigation, we found the following log records in the Console app (the extension ID is redacted):
Computing the code signing dictionary failed for extension with identifier com.youcompany.safariext Blocking extension with identifier: com.youcompany.safariext
To debug the issue, we've created a HelloWorld-like extension generated by Xcode 12.2 beta 4 (http s://sharedartifacts.s3.eu-central-1.amazonaws.com/safariext.app.zip contains a signed app bundle)
It also is under the same code signing issue.
According to https://developer.apple.com/documentation/xcode/notarizing_macos_software_before_distribution/resolving_common_notarization_issues, we've run a few checks to verify:
code signature
➜	Desktop codesign -vvv --deep --strict ./safariext.app					
...-prepared:/Users/nikolay/Desktop/safariext.app/Contents/PlugIns/safariext Extension.appex
...-validated:/Users/nikolay/Desktop/safariext.app/Contents/PlugIns/safariext Extension.appex
...
./safariext.app: valid on disk
./safariext.app: satisfies its Designated Requirement
signing certificate
➜	Desktop spctl -vvv --assess --type exec ./safariext.app		
./safariext.app: accepted
source=Notarized Developer ID
origin=Developer ID
secure timestamp
...
Timestamp=25 Nov 2020 at 22:23:54
...
We seemed to have all checks good, the extension can be installed only if Safari is allowed to run unsigned extensions.
Could anyone assist to debug/resolve this issue?
Thanks
General
RSS for tagExplore the integration of web technologies within your app. Discuss building web-based apps, leveraging Safari functionalities, and integrating with web services.
Post
Replies
Boosts
Views
Activity
We have an ObjC-based Mac App utility. A fair fraction of the functionality is built in JavaScript and resides in a couple of WKWebViews so that we can more easily share code with other platforms. Because it is a utility, usually the application will be hidden or at least not the frontmost application. But if the user hits a hotkey or provides certain other inputs, the app should respond immediately with a series of actions.
In the Obj-C part of the code, we can do this to alert the system that our non-visible, non-active, application is doing something in response to the user input:
[[NSProcessInfo processInfo] beginActivityWithOptions: NSActivityUserInitiatedAllowingIdleSystemSleep reason: @"Do the Thing"]
To get the JavaScript to do the work needed, we call evaluateJavaScript:completionHandler: on one of the WKWebViews. The JavaScript performs a series of computations, then uses window.webkit.messageHandlers.xxxx.postMessage to return results to the ObjectiveC code, which then takes action based on various SDKs, and the user sees the result.
The problem we are encountering is relatively infrequent, but it appears that macOS puts the 'Web Content' process (which every WKWebView has) to sleep, and sometimes delays of many seconds (sometimes over 15 seconds) occur between the evaluateJavaScript:completionHandler: call and the postMessage response. These observed delays are not related to complexity of the JavaScript computations or the amount of data being processed. Using the Console, we can see that evaluateJavaScript:completionHandler: seems to result in this message:
0x104682280 - [PID=0, throttler=0x1046e8498] ProcessThrottler::Activity::Activity: Starting background activity / 'WebPageProxy::runJavaScriptInMainFrameScriptWorld'
Then shortly afterward:
0x104682280 - [PID=0, throttler=0x1046e8498] ProcessThrottler::Activity::invalidate: Ending background activity / 'WebPageProxy::runJavaScriptInMainFrameScriptWorld'
So it seems that evaluateJavaScript:completionHandler: "wakes up" the WKWebView similar to the beginActivityWithOptions:. But many parts of our computation do some work, then expect the next "tick" in JavaScript to continue using the partial result to produce more work. I suspect that the delays are related to the WKWebView being put "back to sleep" before all the "next tick" code executes.
Because these actions are taken in response to user invocation, delays of more than a fraction of a second are instantly noticeable and result in user dismay.
Are there any configuration settings that can prevent the 'Web Content' process from going to sleep? Or (better) techniques or mechanisms that would force the process to "stay awake longer"? (Keeping in mind that the WKWebView is likely not visible, and/or the containing window may be hidden.)
Hello,
I'm keeping on getting a failure when trying to install an App from Samsung Dex. The report says to "disconnect your phone to install" but NO phone is connected. I tried various command line and numerous troubleshooting to reset and refresh some KEXT but still issue exists.
Here is the install.log below.
What could be the work around this bug?
How to reset and proceed with installation?
Thank you
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 16.0px 'Helvetica Neue'; color: #262626; -webkit-text-stroke: #262626; background-color: #ffffff}
span.s1 {font-kerning: none}
2021-07-08 19:33:08-04 KPs-iMac Installer[9137]: @(#)PROGRAM:Install PROJECT:Install-1000
2021-07-08 19:33:08-04 KPs-iMac Installer[9137]: @(#)PROGRAM:Installer PROJECT:Installer-1020
2021-07-08 19:33:08-04 KPs-iMac Installer[9137]: Hardware: iMac18,2 @ 3.00 GHz (x 4), 32768 MB RAM
2021-07-08 19:33:08-04 KPs-iMac Installer[9137]: Running OS Build: macOS 11.4 (20F71)
2021-07-08 19:33:08-04 KPs-iMac Installer[9137]: Env: USER=KP
2021-07-08 19:33:08-04 KPs-iMac Installer[9137]: Env: __CFBundleIdentifier=com.apple.installer
2021-07-08 19:33:08-04 KPs-iMac Installer[9137]: Env: COMMAND_MODE=unix2003
2021-07-08 19:33:08-04 KPs-iMac Installer[9137]: Env: LOGNAME=KP
2021-07-08 19:33:08-04 KPs-iMac Installer[9137]: Env: PATH=/usr/bin:/bin:/usr/sbin:/sbin
2021-07-08 19:33:08-04 KPs-iMac Installer[9137]: Env: SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.LsIZhGSQv0/Listeners
2021-07-08 19:33:08-04 KPs-iMac Installer[9137]: Env: SHELL=/bin/zsh
2021-07-08 19:33:08-04 KPs-iMac Installer[9137]: Env: HOME=/Users/KP
2021-07-08 19:33:08-04 KPs-iMac Installer[9137]: Env: __CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
2021-07-08 19:33:08-04 KPs-iMac Installer[9137]: Env: TMPDIR=/var/folders/d_/hqzchb455m9ct55v66n3n2_w0000gn/T/
2021-07-08 19:33:08-04 KPs-iMac Installer[9137]: Env: XPC_SERVICE_NAME=application.com.apple.installer.1152921500312163432.1152921500312163437
2021-07-08 19:33:08-04 KPs-iMac Installer[9137]: Env: XPC_FLAGS=0x0
2021-07-08 19:33:08-04 KPs-iMac Installer[9137]: Samsung DeX Installation Log
2021-07-08 19:33:08-04 KPs-iMac Installer[9137]: Opened from: /Volumes/Samsung DeX/Install Samsung DeX.pkg
2021-07-08 19:33:09-04 KPs-iMac Installer[9137]: Package Authoring Error: <background_scaling> has an unsupported MIME type: X-NSObject/NSNumber
2021-07-08 19:33:09-04 KPs-iMac Installer[9137]: Package Authoring Error: <background_alignment> has an unsupported MIME type: X-NSObject/NSNumber
2021-07-08 19:33:09-04 KPs-iMac Installer[9137]: Package Authoring Error: has an unsupported MIME type: X-NSObject/NSNumber
2021-07-08 19:33:09-04 KPs-iMac Installer[9137]: Failed to load specified background image
2021-07-08 19:33:09-04 KPs-iMac Installer[9137]: Product archive /Volumes/Samsung DeX/Install Samsung DeX.pkg trustLevel=350
2021-07-08 19:33:09-04 KPs-iMac Installer[9137]: External component packages (2) trustLevel=350
2021-07-08 19:33:09-04 KPs-iMac Installer[9137]: Could not load resource readme: (null)
2021-07-08 19:33:16-04 KPs-iMac Installer[9137]: Installation checks failed.
2021-07-08 19:33:16-04 KPs-iMac Installer[9137]: Installation check failure. . Disconnect your phone to install..
Hello
I have a webrtc-based web app that is loaded inside a WKWebView.
The web app gets loaded just fine in our iOS App running WKWebView on an iPad with iOS 15.1.
We are using the exact same app, built for Mac Catalyst. However, on the Mac version, the web app gets loaded but the RTCPeerConnection object is undefined.. Meaning that our web app assumes that WebRTC is not available in that browser.
Isn't the native app supposed to work the exact same on iOS and MacOS? Is the Mac version of WKWebView more limited than its iOS counterpart ?
Is there any resource that states exactly what is supported in WKWebview in each platform?
Thanks
I wrote a code like the example below to execute javascript code that has no return value.
let webView: WKWebView
// after load complete
let result = await webView.evaluateJavascript("someFunction()") // :0: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value
but when i use method with completion handler manner, it doesn't be crashed. but Xcode enforces me to use 'await' keyword and warning is bordering me
await webView.evaluateJavaScript("someFunction()", completionHandler: nil) // warning: Consider using asynchronous alternative function
The differnce I found is the different signature. Completion handler version has Optional result type, but async/await version has just Any result type
func evaluateJavaScript(_ javaScriptString: String,
completionHandler: ((Any?, Error?) -> Void)? = nil)
func evaluateJavaScript(_ javaScriptString: String) async throws -> Any
my Xcode version is 13.2.1. Hope to fix it soon.
Hi there - I am trying to port over Chrome extension over to Safari Web extension. Looks like Safari has a very aggressive permissions flow which isn't a great user experience but I get the privacy benefits.
I am trying to move some of my permissions like <all_urls> or tabs as optional permissions and build a flow where I can request the user for them in hopes that i can educate them as to why I need them similar to how Chrome/FF have it.
However when i use browser.permissions.request - i always end up getting true without invoking the prompt. The prompt seems to come up regardless when i start visiting a website.
Can someone help with this? Sounds more like a defect in Safari.
I have updated my web extension to use Manifest v3.
While trying to test, I get the error:
_The service_worker script failed to load due to an error.
_
I do not see details on the error, or a place where to find details. Any suggestions?
I'm not sure what is special about Gmail, but my declarativeNetRequest rules are totally ignored.
I make an web extension that blocks email trackers (1x1 pixel images embedded in emails to track if and when you open email sent to you). All images in Gmail are loaded through Google's proxy: googleusercontent.com/proxy/#originalURL
But no matter what I do, I can't block a single image that is loaded in an email. To try and prove it is a bug in Safari, I created a new template web extension in Xcode.
I block all resourceTypes (images and other should be all that is needed) and added two rules:
Block all images loaded through Google's proxy server (this should block all embedded images in all emails)
Block any image with copper in the URL (just in case the blocking doesn't apply to the proxy root url for some reason).
{
"id": 1,
"priority": 1,
"action": { "type": "block" },
"isUrlFilterCaseSensitive": false,
"condition": {
"regexFilter": "googleusercontent.com/proxy",
"resourceTypes": [
"image",
"media",
"main_frame",
"sub_frame",
"stylesheet",
"script",
"font",
"xmlhttprequest",
"ping",
"websocket",
"other"
]
}
},
{
"id": 2,
"priority": 1,
"action": { "type": "block" },
"isUrlFilterCaseSensitive": false,
"condition": {
"regexFilter": "copper",
"resourceTypes": [
"image",
"media",
"main_frame",
"sub_frame",
"stylesheet",
"script",
"font",
"xmlhttprequest",
"ping",
"websocket",
"other"
]
}
}
]
Even though I know this isn't needed, I also added the requester domain (mail.google.com) and the proxy domain (googleusercontent.com) to the permissions list in the manifest file:
...
"declarative_net_request": {
"rule_resources": [{
"id": "ruleset_1",
"enabled": true,
"path": "rules.json"
}]
},
"permissions": [
"declarativeNetRequest",
"*://mail.google.com/*",
"*://*.googleusercontent.com/proxy/*"
]
If I open an email from copper, the image still loads in Gmail
If I right click and select "Open Image in New Tab", the image will not load and I am told it was blocked
If I open a test page that has two images in it, one the image from the email, the image is blocked and the other image is not (as expected, the second image is from wikipedia and should not be blocked)
Running the same extension in Chrome DOES block the image in Gmail (and in all the other cases too)
I'm tasked with securing a Safari browser extension that my organization created. It is using WebExtensions and has been launched across various browser extension stores, including Safari. I've searched for many hours on this and find very very little information on how to secure it. (Pretty much just https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_Security_Policy.) Is there anything more extensive/comprehensive? I'll be dealing with Safari Desktop as well as Safari iOS.
By comparison, when looking for resources for securing the Firefox version of the extension, I found https://extensionworkshop.com/documentation/develop/build-a-secure-extension/, which I think is a great resource. Some of that content applies to Safari, but it's hard to know to what extent. I'll need to secure Safari web and Safari mobile (i.e. iOS), but for now I'm focused on web. (But if you have anything on mobile, then please let me know also.)
Thank you!
I recently noticed that putting the app on background for some time, then switching back to it again causes the WKWebView to reload the current page, same with just hitting f5 on it. How do we disable this behavior?
Everything was working fine for 4 years.
But since Ventura, when the WKWebView is in focus, the keyDown event are not happening. Not only they don't fire inside of web page input box, but they won't register in the app either.
As long as a WKWebView is in focus, the keyboard events won't work.
The app does not receive the key events, and the web page will not receive the js events keyDown and friends. This is particularly painful with auto complete input box.
Test with an empty project with only a WKWebView with this page
https://www.toptal.com/developers/keycode/for/d
It does work fine on iPhone and iPad.
Message to Apple : You force us to use your Safari engine, yet it is always broken. Don't wait for 8 months to fix it this time, we would be tempted to go full web and skip native app with all the store certification problems.
I'm not sure what is special about Gmail of if this is an issue on other sites as well, but my declarativeNetRequest rules are totally ignored in a Safari Extension that runs on Gmail.
I make an web extension that blocks email trackers (1x1 pixel images embedded in emails to track if and when you open email sent to you). All images in Gmail are loaded through Google's proxy: googleusercontent.com/proxy/#originalURL
But no matter what I do, I can't block a single image that is loaded in an email. To try and prove it is a bug in Safari, I created a new template web extension in Xcode.
I block all resourceTypes (images and other should be all that is needed) and added two rules:
Block all images loaded through Google's proxy server (this should block all embedded images in all emails)
Block any image with copper in the URL (just in case the blocking doesn't apply to the proxy root url for some reason).
{
"id": 1,
"priority": 1,
"action": { "type": "block" },
"isUrlFilterCaseSensitive": false,
"condition": {
"regexFilter": "googleusercontent.com/proxy",
"resourceTypes": [
"image",
"media",
"main_frame",
"sub_frame",
"stylesheet",
"script",
"font",
"xmlhttprequest",
"ping",
"websocket",
"other"
]
}
},
{
"id": 2,
"priority": 1,
"action": { "type": "block" },
"isUrlFilterCaseSensitive": false,
"condition": {
"regexFilter": "copper",
"resourceTypes": [
"image",
"media",
"main_frame",
"sub_frame",
"stylesheet",
"script",
"font",
"xmlhttprequest",
"ping",
"websocket",
"other"
]
}
}
]
= = = = = =
Even though I know this isn't needed, I also added the requester domain (mail.google.com) and the proxy domain (googleusercontent.com) to the permissions list in the manifest file:
...
"declarative_net_request": {
"rule_resources": [{
"id": "ruleset_1",
"enabled": true,
"path": "rules.json"
}]
},
"permissions": [
"declarativeNetRequest",
"*://mail.google.com/*",
"*://*.googleusercontent.com/proxy/*"
]
= = = = = =
If I open an email from copper, the image still loads in Gmail:
= = = = = =
If I right click and select "Open Image in New Tab", the image will not load and I am told it was blocked
= = = = = =
If I open a test page that has two images in it, one the image from the email, the image is blocked and the other image is not (as expected, the second image is from wikipedia and should not be blocked)
= = = = = =
Running the same extension in Chrome DOES block the image in Gmail (and in all the other cases too)
= = = = = =
Sidenotes:
This is a reposting of this post which was locked when the wwdc21-10131 tag was applied to the post which disabled my ability to reply, comment, or update the post. Please do NOT apply tags that lock the post.
As requested on the original post by @bweinstein, I filed a bug report on Feedback assistant under FB 10544296 last year and haven't gotten any replies on it.
I verified before reposting this (on Mar 1, 2023) that the bug still exists.
version: iOS 16.4(20E5239a)
both on my iphone and Simulator,Safari -> develop shows "no inspectable applications"
I have enabled inline media playback with code as below:
let config = WKWebViewConfiguration()
config.mediaTypesRequiringUserActionForPlayback = []
config.allowsInlineMediaPlayback = true
let webView = WKWebView(frame: .zero, configuration: config)
But when user touch play button on the video, it's automatically stopped the video and print out some errors as below:
2023-03-30 08:28:46.961218+0700 [22319:217776] [assertion] 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)}>
2023-03-30 08:28:46.961404+0700 [22319:217776] [ProcessSuspension] 0x14dfe8820 - ProcessAssertion: Failed to acquire RBS assertion 'WebKit Media Playback' for process with PID=22415, 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)}
2023-03-30 08:28:46.966357+0700 [22319:217776] [assertion] 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)}>
2023-03-30 08:28:46.966553+0700 [22319:217776] [ProcessSuspension] 0x14dfe8870 - ProcessAssertion: Failed to acquire RBS assertion 'WebKit Media Playback' for process with PID=22319, 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)}
2023-03-30 08:28:46.968951+0700 [22319:217776] [assertion] 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)}>
2023-03-30 08:28:46.969615+0700 [22319:217776] [ProcessSuspension] 0x14dfe88c0 - ProcessAssertion: Failed to acquire RBS assertion 'WebKit Media Playback' for process with PID=22422, 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)}
What's the solution for this issue?
Please help!
When you have a blank Safari new tab open, the browser.tabs.query API inaccurately includes those tabs in results that include a url or title in the query options.
To reproduce, open several tabs, and a blank new tab. Open the background page devtools, and execute the following command:
browser.tabs.query({url: 'https://github.com/'}, console.log)
In addition to any potentially valid results (if you have github.com open, for example), there will also be an entry for the blank tab, which has an empty, non-matching URL.
Tab {
active: true,
audible: false,
height: 1095,
highlighted: true,
id: 6,
incognito: false,
index: 3,
isArticle: false,
isInReaderMode: false,
mutedInfo: {muted: false},
pendingUrl: "",
pinned: false,
status: "complete",
title: "", url: "",
width: 1792,
windowId: 1
}
I hope that this bug can be addressed, as it causes some unexpected behavior.
Hi.
For my Safari Web Extension, using getMatchedRules() from declarativeNetRequest does not seem to work.
I've declared the permission for declarativeNetRequestFeedback in my manifest.json file and tried the activeTab permission too.
getMatchedRules() was added in a previous Safari release and was adjusted in Safari 16.4. I'm using Safari 16.5.
It only returns an empty array when it's called.
I know the rules are there and they're being applied from the static rules json, it's just that getMatchedRules() is not showing them for some reason.
I'm using:
const rules = await browser.declarativeNetRequest.getMatchedRules();
But it only ever returns:
{rulesMatchedInfo: []}
Can anyone tell me what I'm doing wrong please? The same code works fine in Chromium based browsers.
Thank you.
Hello, I'm trying to learn swift and making the Landmarks tutorial I found a problem with the map view. The error read as follow: "'init(coordinateRegion:interactionModes:showsUserLocation:userTrackingMode:)' was deprecated in iOS 17.0: Use Map initializers that take a MapContentBuilder instead."
My code is:
import MapKit
struct MapView: View {
@State private var region = MKCoordinateRegion(
center: CLLocationCoordinate2D(latitude: 34.011_286, longitude: -116.166_868),
span: MKCoordinateSpan(latitudeDelta: 0.2, longitudeDelta: 0.2)
)
// The error happens here!
var body: some View {
Map(coordinateRegion: $region)
}
}
#Preview {
MapView()
}
Any suggestions about hot to solve this will be appreciate it.
Thanks,
BR
Skalex
Hello,
I am trying to apply ProxyConfiguration on the WebKit webview.
I've tried HTTP and SOCKSv5 without authentication, and it proxies normally. However, after I set up username authenticate on the server side, then set username and password with applyCredential on the client side, it couldn't authenticate the connection.
Logs on the server side show the client side says it doesn't support any authentication.
So I have some questions about the authentication:
Does the ProxyConfiguration support authentication now?
Does applyCredential apply credentials on HTTP/HTTPS and SOCKSv5 proxy?
The Safari version for VisionOS (or spatial computing) supports WebXR, as reported here.
I am developing a Web App that intends to leverage WebXR, so I've tested several code samples on the safari browser of the Vision Pro Simulator to understand the level of support for immersive web content.
I am currently facing an issue that seems like a bug where video playback stops working when entering an XR session (i.e. going into VR mode) on a 3D web environment (using ThreeJS or similar).
There's an example from the Immersive Web Community Group called Stereo Video (https://immersive-web.github.io/webxr-samples/stereo-video.html) that lets you easily replicate the issue, the code is available here.
It's worth mentioning that video playback has been successfully tested on other VR platforms such as the Meta Quest 2.
The issue has been reported in the following forums:
https://discourse.threejs.org/t/videotexture-playback-html5-videoelement-apple-vision-pro-simulator-in-vr-mode-not-playing/53374
https://bugs.webkit.org/show_bug.cgi?id=260259
what is the url scheme safari ?
I tried this way:
window.open(`com-apple-mobilesafari-tab:https://mysite.ao}/?a`, '_blank', 'popup');