Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Half of the chrome privacy API is not available #204

Closed
Manvel opened this issue Oct 14, 2019 · 9 comments
Closed

Half of the chrome privacy API is not available #204

Manvel opened this issue Oct 14, 2019 · 9 comments

Comments

@Manvel
Copy link
Contributor

Manvel commented Oct 14, 2019

Just noticed that:

browser.privacy.websites.thirdPartyCookiesAllowed.get({});

Throws the error below:

Uncaught TypeError: Error in invocation of types.ChromeSetting.get(object details, function callback): No matching signature.

I'm new to current polyfill library, but having a rough look into the src/browser-polyfill.js seems like there are some privacy APIs that are available in Chrome which are not supported by webextension-polyfill.

Not sure if that is intentional that not all Chrome APIs are supported, but if Chrome API support can be ensured, that will help me a lot making my Chrome Extension also being available in Firefox.

Manvel added a commit to Manvel/webextension-polyfill that referenced this issue Oct 14, 2019
@Rob--W
Copy link
Member

Rob--W commented Oct 14, 2019

Support for the privacy namespace in the polyfill was introduced in #133, and APIs that weren't supported in Firefox were intentionally left out, because extensions that use those APIs are not cross-browser compatible.

So far, the scope of the polyfill has been to only provide a polyfill to APIs that are implemented by Firefox. I'm not opposed to supporting promises in the full privacy namespace if there are good reasons for it. If we really want to support promises in any part of the API namespace, then I wonder whether we should have a generic wrapper for any property in the privacy.{network,services,websites} namespace without explicitly enumerating all properties.

Not sure if that is intentional that not all Chrome APIs are supported, but if Chrome API support can be ensured, that will help me a lot making my Chrome Extension also being available in Firefox.

How would providing a promisified version of the API help you with making the extension available to Firefox, if those APIs are only supported in Chrome?

@Manvel
Copy link
Contributor Author

Manvel commented Oct 14, 2019

Support for the privacy namespace in the polyfill was introduced in #133, and APIs that weren't supported in Firefox were intentionally left out, because extensions that use those APIs are not cross-browser compatible.

I see, hmm waiting Chrome switching into using promises don't seem to be something we can expect unfortunately anytime soon :( Same seem to be true for using Browser.* instead of Chrome.*.

So far, the scope of the polyfill has been to only provide a polyfill to APIs that are implemented by Firefox. I'm not opposed to supporting promises in the full privacy namespace if there are good reasons for it.

My reason is that I'm looking for a polyfill library that will allow me to use both Chrome and Firefox Web Extensions API using a common namespace browser.*, this way I don't need to write my own wrapper and save time for making my extension being available both for Firefox and Chrome. Seems like current polyfill weren't mean for such a use case and I have misinterpreted it, that's fare enough.

If we really want to support promises in any part of the API namespace

Who decides what to support?

I wonder whether we should have a generic wrapper for any property in the privacy.

Yep, make sense. I'll be happy to update my PR if you say that you want support Chrome API as well.

How would providing a promisified version of the API help you with making the extension available to Firefox, if those APIs are only supported in Chrome?

Plan is to check for the support of each specific Privacy API and load privacy setting switch accordingly in the extension I'm working on. Switching my codebase into using promises and browser.* namespace instead of chrome.* will help me more easily make my whole extension be available and keep supporting both in Firefox and Chrome(now it's only in Chrome), because both will share same namespace and code I believe.
Reference -> Privacy-Managers/Privacy-Manager#37

@Manvel
Copy link
Contributor Author

Manvel commented Oct 14, 2019

If we really want to support promises in any part of the API namespace, then I wonder whether we should have a generic wrapper for any property in the privacy.

Updated the PR accordingly, just in case.

Update: Reverted - need some more time to implement that and ensure all tests are passing, will wait for decision before coming back to this issue.

@Rob--W
Copy link
Member

Rob--W commented Oct 15, 2019

I spoke with @rpl and we are willing to accept a PR that provides a consistent (promise-based) API interface for anything in the browser.privacy.{network,services,websites} namespace.

@Manvel
Copy link
Contributor Author

Manvel commented Oct 15, 2019

Thank you @Rob--W I'm working full-time today and tomorrow, I'll work on the PR this Thursday, meanwhile any hints that might be helpful for me updating the PR will be highly appreciated(if any), otherwise I'll figure things out myself.

@Manvel
Copy link
Contributor Author

Manvel commented Oct 17, 2019

@Rob--W the PR is updated, hope it's good enough to get approved, otherwise happy to revisit. Looking forward to start using the package.

@Rob--W
Copy link
Member

Rob--W commented Nov 21, 2019

Fixed by #205.

@Rob--W Rob--W closed this as completed Nov 21, 2019
@Manvel
Copy link
Contributor Author

Manvel commented Dec 20, 2019

@Rob--W Any idea when new version of the package will be published? Asking that as I'm still using my fork, until builds are available in the NPM package.

Thinking that it would be handy to generate "./dist" on npm i, that way it would be possible to use package from GIthub(github:mozilla/webextension-polyfill), as currently it doesn't seem to be possible.

Thanks in advance.

@Rob--W
Copy link
Member

Rob--W commented Dec 20, 2019

@Manvel We will release a new version shortly, thanks for your reminder and patience!

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

No branches or pull requests

3 participants