-
Notifications
You must be signed in to change notification settings - Fork 215
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
Compatibility with environments that have the browser
namespace but don't support promises
#3
Comments
browser
namespace but don't support promisesbrowser
namespace but don't support promises (i.e. Microsoft Edge)
browser
namespace but don't support promises (i.e. Microsoft Edge)browser
namespace but don't support promises
Edge is planning to add promise support, but yes, I've been thinking about ways to detect this and add support where it's not available. |
Well, I presume it will still take a while until Microsoft Edge will support promises, and when it does extension developers might not be able to drop support for older versions of Microsoft Edge right away. Also what if Chrome (or a new platform) will start to provide the As for detecting the promise-based API, the best idea I have is just calling any asynchronous function and check whether it throws an exception (because a callback is expected) or whether a promise is returned. if (typeof browser == "undefined")
var browser = chrome;
var _supportsPromises = false;
try {
_supportsPromises = browser.runtime.getPlatformInfo() instanceof Promise;
}
catch (e)
{
}
if (!_supportsPromises)
browser = wrapAPI(browser); |
Here's the issue on the Microsoft end: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/9421085/. Maybe they'll post an update if a decent amount of people click the "Me too" button. |
:( |
https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/9421085/ |
Considering Microsoft's track record of not following standards and their somewhat recent desire to not be like that anymore, it's really weird that they're so dismissive about this… I guess supporting this in the polyfill would be the only solution for now :( |
Ideally I would like to use this polyfill but due to edge I was using this really short polyfill and it was working well: @constfun I find this works for me across all browsers including edge:
Usage example:
The only issue i see is in To use this, just do Edge is also funky in that they have |
What a sad state of affairs. It looks like Chrome doesn't care about Mozilla's WebExtensions standardization effort and Edge just (barely) follows whatever Chrome does. On top of that, Chrome's original API is pretty ridiculous to begin with. At this point I wish mozilla came up with a sound API and polyfilled that. |
@bfred-it uhh this repo is exactly the polyfill :) |
Yeah but mozilla's API still looks like It could have looked more like a familiar |
that's pretty minor compared to using promises instead of callbacks |
Aw man, just began working on a Web Extension and ran into this. Hope this can be prioritized soon / maybe I'll try to take a jab at it at some point. |
At the moment, neither a working polyfill, nor any other cross browser solution exists. May I suggest some possible improvements:
On point 1, I argue that it is more robust and simpler than attempting non-trivial feature detection, as in #43. The set of browsers currently supporting WebExtensions is known and the chances of your extension working in some other incarnation of the API without being explicitly targeted is slim. On point 2, an anecdote. I just had a fun time on a project that also uses pastak/chrome-browser-object-polyfill. That polyfill makes its own assumptions about the A cross platform library is more useful to me as a developer than a polyfill that seals off all escape hatches by monkey patching globals. |
The Edge issue has been re-opened by Edge team… |
@rpl and I talked about this:
|
@Rob--W Any estimations for including this functionality in webextension-polyfill ? |
Any ideas when this will be completed? I've seen multiple proposed pull requests and they always get shot down for some reason or another. It seems like a lot of "paralysis by over-analysis". It's been almost 2 years. Please implement something, even if it's temporary and not your ideal solution. |
One of the big blockers is the ability to load an extension in Edge for automated testing (locally and on continuous integration, e.g. on AppVeyor). If someone spends time on researching that, then I am willing to make the desired changes to the polyfill to support Edge. |
In Adblock Plus we have written our own polyfill to wrap the async APIs on Chrome and Edge. It works for us. |
@Rob--W. the lack of automated testing isn't necessarily a blocker for releasing this feature. |
@Rob--W Sadly AppVeyor won’t support Microsoft Edge testing. All tests on AppVeyor run on Windows Server 2012/2016, but MS Edge doesn’t support Windows Server at all. So far the only option that I know is BrowserStack, which has free plan for open-source projects, but I guess it would take some time to set up Selenium. I think we Edge users would be happy enough if Edge is supported on a best-effort basis. We don’t need any guarantee about non-breaking release because we understand the difficulty. |
Soon Edge will use Chromium inside so it's reasonable to expect Edge will have the classic chrome API for extensions, which would solve the polyfill compatibility problem too. |
There are many companies using Edge right now. |
TBH Microsoft announced that too early. Now nobody would develop against the classic MS Edge no matter when the new Edge come out. This is not the only project; there is also some discussion at EFForg/https-everywhere#5101. |
Unfortunately, I do have to develop for current Edge.:( |
Closing as wontfix. See #114 (comment) for a rationale. @NN--- @vozeldr you may give a try to the alternative approach described in the above comment (and in the example-msedge-extension-with-webextension-polyfill github repo). |
I already do the same using Webpack and currently don't need any Edge specific features. |
This polyfill seems to be incompatible with Microsoft Edge, which doesn't support promises yet, but is using the
browser
instead of thechrome
namespace.The text was updated successfully, but these errors were encountered: