Pier Angelo Vendrame pushed to branch tor-browser-140.3.0esr-15.0-1 at The Tor 
Project / Applications / Tor Browser


Commits:
55015024 by Pier Angelo Vendrame at 2025-09-30T11:36:17+02:00
fixup! BB 19741: Fix FPI with OpenSearch.

Fix the principal and add FPD also to opensearch images.

- - - - -


2 changed files:

- browser/components/search/SearchUIUtils.sys.mjs
- toolkit/components/search/SearchUtils.sys.mjs


Changes:

=====================================
browser/components/search/SearchUIUtils.sys.mjs
=====================================
@@ -184,7 +184,7 @@ export var SearchUIUtils = {
       await Services.search.addOpenSearchEngine(
         locationURL,
         image,
-        browsingContext?.originAttributes
+        browsingContext?.embedderElement?.contentPrincipal?.originAttributes
       );
     } catch (ex) {
       let titleMsgName;


=====================================
toolkit/components/search/SearchUtils.sys.mjs
=====================================
@@ -253,10 +253,21 @@ export var SearchUtils = {
     }
     try {
       let uri = typeof url == "string" ? Services.io.newURI(url) : url;
-      let principal =
-        uri.scheme == "moz-extension"
-          ? Services.scriptSecurityManager.createContentPrincipal(uri, {})
-          : Services.scriptSecurityManager.createNullPrincipal({});
+      let principal;
+      if (uri.scheme == "moz-extension") {
+        principal = Services.scriptSecurityManager.createContentPrincipal(
+          uri,
+          {}
+        );
+      } else {
+        let originAttributes = {};
+        try {
+          originAttributes.firstPartyDomain =
+            Services.eTLD.getSchemelessSite(uri);
+        } catch {}
+        principal =
+          Services.scriptSecurityManager.createNullPrincipal(originAttributes);
+      }
 
       return Services.io.newChannelFromURI(
         uri,



View it on GitLab: 
https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/55015024a190faf1b69c4b7962ae9c6d5a4fed9c

-- 
View it on GitLab: 
https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/55015024a190faf1b69c4b7962ae9c6d5a4fed9c
You're receiving this email because of your account on gitlab.torproject.org.


_______________________________________________
tor-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to