{"action":"created","issue":{"url":"https://api.github.com/repos/hypothesis/browser-extension/issues/14","repository_url":"https://api.github.com/repos/hypothesis/browser-extension","labels_url":"https://api.github.com/repos/hypothesis/browser-extension/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/hypothesis/browser-extension/issues/14/comments","events_url":"https://api.github.com/repos/hypothesis/browser-extension/issues/14/events","html_url":"https://github.com/hypothesis/browser-extension/issues/14","id":196174983,"number":14,"title":"Initial work for Firefox and Edge extensions","user":{"login":"sean-roberts","id":950274,"avatar_url":"https://avatars3.githubusercontent.com/u/950274?v=4","gravatar_id":"","url":"https://api.github.com/users/sean-roberts","html_url":"https://github.com/sean-roberts","followers_url":"https://api.github.com/users/sean-roberts/followers","following_url":"https://api.github.com/users/sean-roberts/following{/other_user}","gists_url":"https://api.github.com/users/sean-roberts/gists{/gist_id}","starred_url":"https://api.github.com/users/sean-roberts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sean-roberts/subscriptions","organizations_url":"https://api.github.com/users/sean-roberts/orgs","repos_url":"https://api.github.com/users/sean-roberts/repos","events_url":"https://api.github.com/users/sean-roberts/events{/privacy}","received_events_url":"https://api.github.com/users/sean-roberts/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-12-16T23:15:02Z","updated_at":"2017-09-01T09:04:00Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"With the new extensions API, we can now consolidate and ship firefox and edge extensions along side our chrome.\r\n\r\nI have worked through getting local versions of the extensions up and running. There are a few checks and balances that are checked when uploading to the addon/extension stores but those offer very explicit changes if any. Here are the things we need to do to get the extensions up and running:\r\n\r\n**Firefox** seems to support the extension as is but had an issue with our incognito mode setting. They require \"spanning\".\r\n\r\n**Edge** is still missing support for some features. \r\n\r\n- The main one is storage.sync. Which based on our current usage of it, we can look to see if the api is available and only use that feature if it is available.\r\nhttps://github.com/hypothesis/browser-extension/blob/master/src/common/hypothesis-chrome-extension.js#L268\r\n\r\n**Edge** is not supporting the chrome namespace so we can add two things to support this:\r\n- The bridges: https://gist.github.com/Scrxtchy/f1322606285af3c26d1d along with this addition to the manifest\r\n```\r\n  \"-ms-preload\": {\r\n    \"backgroundScript\": \"backgroundScriptsAPIBridge.js\",\r\n    \"contentScript\": \"contentScriptsAPIBridge.js\"\r\n  },\r\n```\r\n- Add `var chrome = root.chrome || root.browser || root.msBrowser;` to extension aware scripts (extension.bundle.js and embed.js)\r\n\r\n**Edge** is not liking some stuff as well:\r\n- polyfills.js module needs to actually return something. So add `module.exports = {}` stops a thrown error\r\n- this might be the same as this: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities#JavaScript_APIs and we need to just use the right hook. I don't know that these functions are critical for first pass (used to show annotations count) but an error is thrown from:\r\n```\r\nchromeBrowserAction.setBadgeText({tabId: tabId, text: badgeText});\r\nchromeBrowserAction.setIcon({tabId: tabId, path: activeIcon});\r\nchromeBrowserAction.setTitle({tabId: tabId, title: title});\r\n```\r\n\r\n\r\nlist of chrome compatibility diffs if needed: \r\n\r\nhttps://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities\r\nhttps://developer.microsoft.com/en-us/microsoft-edge/platform/documentation/extensions/guides/porting-chrome-extensions/\r\n\r\nedge api support:\r\nhttps://developer.microsoft.com/en-us/microsoft-edge/platform/documentation/extensions/api-support/supported-apis/\r\n\r\nIdeally, we can also upgrade our build process to make having three extensions easier to manage - but definitely a follow up"},"comment":{"url":"https://api.github.com/repos/hypothesis/browser-extension/issues/comments/326529845","html_url":"https://github.com/hypothesis/browser-extension/issues/14#issuecomment-326529845","issue_url":"https://api.github.com/repos/hypothesis/browser-extension/issues/14","id":326529845,"user":{"login":"robertknight","id":2458,"avatar_url":"https://avatars1.githubusercontent.com/u/2458?v=4","gravatar_id":"","url":"https://api.github.com/users/robertknight","html_url":"https://github.com/robertknight","followers_url":"https://api.github.com/users/robertknight/followers","following_url":"https://api.github.com/users/robertknight/following{/other_user}","gists_url":"https://api.github.com/users/robertknight/gists{/gist_id}","starred_url":"https://api.github.com/users/robertknight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertknight/subscriptions","organizations_url":"https://api.github.com/users/robertknight/orgs","repos_url":"https://api.github.com/users/robertknight/repos","events_url":"https://api.github.com/users/robertknight/events{/privacy}","received_events_url":"https://api.github.com/users/robertknight/received_events","type":"User","site_admin":false},"created_at":"2017-09-01T09:04:00Z","updated_at":"2017-09-01T09:04:00Z","author_association":"CONTRIBUTOR","body":"Thanks for flagging that up @tilgovi . It was working at some point not long ago, so it needs investigation."}}
{"actor":{"display_login":"robertknight"}}