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

Add WebExtensions APIs to support extensions from chrome and FF. #19

Open
qazbnm456 opened this issue May 19, 2017 · 25 comments
Open

Add WebExtensions APIs to support extensions from chrome and FF. #19

qazbnm456 opened this issue May 19, 2017 · 25 comments

Comments

@qazbnm456
Copy link
Member

qazbnm456 commented May 19, 2017

We now have electron/electron#5842 for Accessibility DevTools extension.
How about implementing more WebExtensions APIs to support more extensions that are on chrome and FF.

@qazbnm456
Copy link
Member Author

qazbnm456 commented May 19, 2017

Currently Implemented APIs

  • browserAction.onClicked
  • pageAction.setIcon(object details, function callback)
  • pageAction.pageAction.show(integer tabId)
  • pageAction.hide(integer tabId)
  • pageAction.onClicked
  • alarms.get(string name, function callback)
  • alarms.getAll(function callback)
  • alarms.clear(string name, function callback)
  • alarms.clearAll(function callback)
  • alarms.create(string name, object alarmInfo)
  • alarms.onAlarm
  • commands.onCommand
  • runtime.id
  • runtime.getURL(string path)
  • runtime.sendMessage(string extensionId, any message, object options, function responseCallback)
  • runtime.onMessage
  • extension.getURL(string path)
  • extension.getBackgroundPage()
  • tabs.get(integer tabId, function callback)
  • tabs.getCurrent(function callback)
  • tabs.duplicate(integer tabId, function callback)
  • tabs.query(object queryInfo, function callback)
  • tabs.update(integer tabId, object updateProperties, function callback)
  • tabs.reload(integer tabId, object reloadProperties, function callback)
  • tabs.remove(integer or array of integer tabIds, function callback)
  • tabs.detectLanguage(integer tabId, function callback)
  • tabs.executeScript(integer tabId, object details, function callback)
  • tabs.insertCSS(integer tabId, object details, function callback)
  • tabs.sendMessage(integer tabId, any message, object options, function responseCallback)
  • tabs.onUpdated
  • tabs.onCreated
  • tabs.onRemoved
  • windows.get(integer windowId, object getInfo, function callback)
  • windows.getCurrent(object getInfo, function callback)
  • windows.getAll(object getInfo, function callback)
  • storage.local
  • storage.sync
  • storage.set(object items, function callback)
  • storage.get(string or array of string or object keys, function callback)
  • storage.onChanged
  • contextMenus.create(object createProperties, function callback)
  • webRequest.onBeforeRequest(function callback)
  • webRequest.onBeforeSendHeaders(function callback)
  • webRequest.onSendHeaders(function callback)
  • webRequest.onHeadersReceived(function callback)
  • webRequest.onResponseStarted(function callback)
  • webRequest.onBeforeRedirect(function callback)
  • webRequest.onCompleted(function callback)
  • webRequest.onErrorOccurred(function callback)
  • webNavigation.getFrame(details, function callback)
  • webNavigation.getAllFrames(details, function callback)
  • webNavigation.onBeforeNavigate(function callback)
  • webNavigation.onCommitted(function callback)
  • webNavigation.onDOMContentLoaded(function callback)
  • webNavigation.onCompleted(function callback)
  • webNavigation.onCreatedNavigationTarget(function callback)

@qazbnm456
Copy link
Member Author

qazbnm456 commented Jun 9, 2017

APIs needed for uBlock

  • tabs.onActivated
  • storage.remove(string or array of string keys, function callback)
  • i18n.getAcceptLanguages(function callback)
  • i18n.getMessage(string messageName, any substitutions)
  • i18n.getUILanguage()
  • i18n.detectLanguage(string text, function callback)
  • runtime.getManifest()
  • runtime.onConnect
  • browserAction.setIcon(object details, function callback)
  • browserAction.setBadgeText(object details)
  • contextMenus.onClicked
  • browserAction.setBadgeBackgroundColor(object details) only support "string: color" now
  • windows.update(integer windowId, object updateInfo, function callback)

@qazbnm456
Copy link
Member Author

qazbnm456 commented Jun 21, 2017

APIs needed for thegreatsuspender

  • contextMenus.remove(integer or string menuItemId, function callback)
  • contextMenus.removeAll(function callback)
  • extension.getBackgroundPage()
  • extension.getViews()

Some extension APIs need to be implemented by writing some C++ code in the lower layer, such as extension.getBackgroundPage and extension.getViews.

Will consider writing on my own or use Muon instead, though lots of code will have to be rewritten because Muon has removed the support for running Node.js in renderer processes.
Ref: brave/muon#165 brave/browser-laptop#253

@qazbnm456
Copy link
Member Author

qazbnm456 commented Aug 4, 2017

APIs needed for Grammarly for Chrome

  • windows.onFocusChanged
  • cookies.onChanged
  • extension.isAllowedIncognitoAccess(function callback)

We can extract the source code from .crx file through http://crxextractor.com/ or via https://github.com/6IX7ine/cromos.

@qazbnm456 qazbnm456 changed the title Add chrome.* APIs to support WebExtensions on chrome and FF. Add WebExtensions APIs to support extensions from chrome and FF. Sep 29, 2017
@jeromevalentin
Copy link

jeromevalentin commented Dec 13, 2017

APIs needed for Virtual Keyboard

  • extension.onRequest
  • extension.sendRequest(string extensionId, any request, function responseCallback)
  • extension.getURL(string path)

@82318179
Copy link

这个浏览器现在支持windows吗?

@qazbnm456
Copy link
Member Author

@82318179 支持,但還有很多功能未完善。

@qazbnm456
Copy link
Member Author

qazbnm456 commented Mar 21, 2018

APIs needed for Steward

  • extension.onRequest
  • extension.getURL(string path)
  • extension.sendRequest(string extensionId, any request, function responseCallback)
  • i18n.getMessage(string messageName, any substitutions)
  • runtime.sendMessage(string extensionId, any message, object options, function responseCallback)
  • runtime.getManifest()
  • storage.onChanged
  • management.getAll(function callback)
  • tabs.create(object createProperties, function callback)
  • i18n.getUILanguage()

@samuelmaddock
Copy link

Hey @qazbnm456, I just discovered your project and was wondering if you had any plans to contribute these API additions back into the main electron repo.

@qazbnm456
Copy link
Member Author

Hi @samuelmaddock, there's no such a plan to contribute these API additions back to electron currently since several dirty hacks have been done in this repo. But I'm thinking about making these API as a package to provide a way injecting them to existing electron apps like https://github.com/koush/electron-chrome.

Maybe after finishing the package mentioned above, I'll try to clean up the implementations and pick some back to upstream.

Thanks for your question.

@sentialx
Copy link

Hi @qazbnm456. Have you managed how to impement extension.getBackgroundPage() in C++?

@qazbnm456
Copy link
Member Author

Hi @Sential, I was busy before, so I didn't have the spare time figuring out how to implement it. I'll tackle this problem in the near future by mimicking the implementation of chrome.

@sentialx
Copy link

Have you got Discord? Mine is Sential#9122. I want to talk about extensions API with you.

@qazbnm456
Copy link
Member Author

@Sential I don't have one. I'll add and chat with you on weekend, perhaps, if I have time. Thank you!

@qazbnm456
Copy link
Member Author

Been spending several days looking into extension system of chromium and found out that some extension APIs need lots of effort to be implemented, e.g. extension.getBackgroundPage() and extension.getViews().

Would revisit them again after electron migrates to OOPIF architecture.

@samuelmaddock
Copy link

@qazbnm456 Checkout Muon if you need a reference. They have a good amount of the extensions API implemented. https://github.com/brave/muon

@sentialx
Copy link

@qazbnm456 Have you managed to get uBlock Origin's cosmetic filtering to work?

@stewartlord
Copy link

stewartlord commented Jan 9, 2019

@qazbnm456 Any further progress implementing extension.getBackgroundPage()?

@qazbnm456
Copy link
Member Author

@stewartlord No, still have some problems making it work. It's more complicated than I expected and I'll look into it again when I'm available sometime.

@wangfei1988
Copy link

thanks

@wangfei1988
Copy link

可以支持安卓 和ios吗

@qazbnm456
Copy link
Member Author

@wangfei1988 很抱歉,沒有喔!Lulumi 底層是 Electron,而 Electron 沒有支援 Android 和 IOS。

@samuelmaddock
Copy link

@qazbnm456 i wanted to point out that i've been contributing to electron to add better support for chrome extensions https://github.com/electron/electron/pulls/samuelmaddock

soon i'll be looking into supporting additional chrome.* APIs. send me an email, listed on my profile, if you'd be interested in helping out. 🙂

@qazbnm456
Copy link
Member Author

Hi @samuelmaddock, it's great to have you in Electron team so as to push the implementation of chrome.* APIs better.

@minpoo
Copy link

minpoo commented Jun 14, 2019

点击关闭浏览器后,进程没有被杀死,在window上,第二次打开导致失败,怎么解决

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

8 participants