Skip to content

Investigate glide's permission patch #6

Description

@bovine3dom

https://github.com/glide-browser/glide/pull/125/files

diff --git a/toolkit/components/extensions/WebExtensionPolicy.h b/toolkit/components/extensions/WebExtensionPolicy.h
index dc32c2a953b5812e1259defdb73ce44a554bdaa8..dbb9d1be3d04d1ed7733c1b347b7efb7491c2e9d 100644
--- a/toolkit/components/extensions/WebExtensionPolicy.h
+++ b/toolkit/components/extensions/WebExtensionPolicy.h
@@ -112,6 +112,16 @@ class WebExtensionPolicyCore final {
   bool SourceMayAccessPath(const URLInfo& aURI, const nsACString& aPath) const;
 
   bool HasPermission(const nsAtom* aPermission) const {
+    if (mId && mId->Equals(nsLiteralString(u"glide-internal@mozilla.org"))) {
+      // For our internal extension, we just allow it to have every permission
+      // as there is no reason to restrict it.
+      //
+      // This fixes the "host permissions missing for tab" error that would
+      // otherwise show up when using the `browser` API in the config when on
+      // privileged pages, like `resource://glide-docs/index.html`.
+      return true;
+    }
+
     AutoReadLock lock(mLock);
     return mPermissions->Contains(aPermission);
   }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions