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

fix: Update existing namespaces in api-metadata.json #125

Merged
merged 9 commits into from Jun 15, 2018

Conversation

Rob--W
Copy link
Member

@Rob--W Rob--W commented Jun 5, 2018

I have auto-generated the schema signatures for Chrome 54 and Chrome 67, and manually merged the result, as follows:

  • Ensure that the keys are alphabetically sorted.
  • Remove keys that are not implemented by either browser.
  • Add methods that are supported by both Firefox and Chrome.
  • Add fallbackToNoCallback where needed.

This PR only modifies existing namespaces. Missing namespaces will be added by other PRs.

Fixes #26
Fixes #93

The diff between the output of #122 and the api-metadata after this is as follows (I added comments to explain the discrepancies):

164,178d163
  The tool from #122 does not generate the devtools namespace
<   "devtools": {
<     "inspectedWindow": {
<       "eval": {
<         "minArgs": 1,
<         "maxArgs": 2
<       }
<     },
<     "panels": {
<       "create": {
<         "minArgs": 3,
<         "maxArgs": 3,
<         "singleCallbackArg": true
<       }
<     }
<   },
179a165,168
  Firefox does not support acceptDanger.
>     "acceptDanger": {
>       "minArgs": 1,
>       "maxArgs": 1
>     },
196,200d184
  Chrome's downloads.open method does not take a callback.
  (and the tool omits all non-callback methods).
<     "open": {
<       "minArgs": 1,
<       "maxArgs": 1,
<       "fallbackToNoCallback": true
<     },
216,220d199
  Chrome's downloads.show method does not take a callback.
  (and the tool omits all non-callback methods).
<     },
<     "show": {
<       "minArgs": 1,
<       "maxArgs": 1,
<       "fallbackToNoCallback": true
230a210,221
  Firefox does not support extension messaging in the extension namespace.
  (only in the runtime namespace)
>     },
>     "sendMessage": {
>       "minArgs": 1,
>       "maxArgs": 3
>     },
>     "sendNativeMessage": {
>       "minArgs": 2,
>       "maxArgs": 2
>     },
>     "sendRequest": {
>       "minArgs": 1,
>       "maxArgs": 2
269a261,272
  Firefox's identity API does not support several of Chrome's.
  https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/identity#Functions
  https://developer.chrome.com/extensions/identity#toc
>     "getAccounts": {
>       "minArgs": 0,
>       "maxArgs": 0
>     },
>     "getAuthToken": {
>       "minArgs": 0,
>       "maxArgs": 1
>     },
>     "getProfileUserInfo": {
>       "minArgs": 0,
>       "maxArgs": 0
>     },
272a276,279
>     },
>     "removeCachedAuthToken": {
>       "minArgs": 1,
>       "maxArgs": 1
281a289,296
  Firefox's management API does not support all of Chrome's APIs
  https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/management#Functions
  https://developer.chrome.com/extensions/management#toc
>     "createAppShortcut": {
>       "minArgs": 1,
>       "maxArgs": 1
>     },
>     "generateAppForLink": {
>       "minArgs": 2,
>       "maxArgs": 2
>     },
289a305,312
>     "getPermissionWarningsById": {
>       "minArgs": 1,
>       "maxArgs": 1
>     },
>     "getPermissionWarningsByManifest": {
>       "minArgs": 1,
>       "maxArgs": 1
>     },
293a317,320
>     "launchApp": {
>       "minArgs": 1,
>       "maxArgs": 1
>     },
297a325,332
>     "setLaunchType": {
>       "minArgs": 2,
>       "maxArgs": 2
>     },
>     "uninstall": {
>       "minArgs": 1,
>       "maxArgs": 2
>     },
364c399
  Chrome does not support runtime.getBrowserInfo,
<     "getBrowserInfo": {
---
  Firefox does not support runtime.getPackageDirectoryEntry
>     "getPackageDirectoryEntry": {
379a415,418
  Firefox does not support runtime.restartAfterDelay
>     "restartAfterDelay": {
>       "minArgs": 1,
>       "maxArgs": 1
>     },
416a456,459
  Firefox does not define storage.management.clear/remove/set.
  Chrome does, because it re-uses the same class for all storage APIs.
>       "clear": {
>         "minArgs": 0,
>         "maxArgs": 0
>       },
423a467,474
>       },
>       "remove": {
>         "minArgs": 1,
>         "maxArgs": 1
>       },
>       "set": {
>         "minArgs": 1,
>         "maxArgs": 1
477a529,532
  Firefox does not support tabs.getAllInWindow
  (MDN currently says that it does, but that is wrong and I will submit a fix for that)
  Chrome has deprecated it in favor of tabs.query.
>     "getAllInWindow": {
>       "minArgs": 0,
>       "maxArgs": 1
>     },
481a537,540
  Firefox does not support tabs.getSelected
  Chrome has deprecated it in favor of tabs.query.
>     "getSelected": {
>       "minArgs": 0,
>       "maxArgs": 1
>     },
514,517d572
  Chrome does currently not support tabs.removeCSS
  It may be added in the future - https://crbug.com/608854
<     "removeCSS": {
<       "minArgs": 1,
<       "maxArgs": 2
<     },
521a577,580
  Firefox does not support tabs.sendRequest (which is deprecated by Chrome)
>     "sendRequest": {
>       "minArgs": 2,
>       "maxArgs": 2
>     },

- Alphabetically sort keys
- Add `"fallbackToNoCallback": true` to `open` and `show`
  because these methods do currently not take any callbacks in Chrome:
  https://developer.chrome.com/extensions/downloads#method-open
  https://developer.chrome.com/extensions/downloads#method-show
- Chrome has a `downloads.acceptDanger` method, but Firefox does not,
  so this is not included in the schema.
setEnabled is partially implemented in Firefox:
- https://bugzil.la/1282982
- https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/management/setEnabled

The management API has many more methods in Chrome,
Firefox does not support them:
- createAppShortcut
- generateAppForLink
- getPermissionWarningsById
- getPermissionWarningsByManifest
- launchApp
- setLaunchType
- uninstall
- Alphabetically sort keys
- Remove non-existing pageAction.getIcon
  (neither Firefox nor Chrome support this method).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tabs.discard isn't polyfilled
2 participants