Skip to content

Refactoring chrome-extension.js #43

@alexstrat

Description

@alexstrat

chrome-extension.js is a big, but ugly, file that holds big parts of logic. If we want to make the lib more easy to work on, we should refactor this file.

chrome-extension.js expose 2 public APIs:

  • addExtension(extensionId, srcDirectory)
  • removeExtension(extensionId)

addExtension is responsible for:

  • reading and interpreting manifest.json
  • starting background pages
  • instantiating API handlers via (fairly recent) ChromeAPIHandler for storage, webRequest, windows
  • defining some API handlers (legacy, to be moved to ChromeAPIHandler) for runtime, tabs, web navigation (others ?)
  • doing content scrips injection
  • doing content-security injection (?): seems very hacky
  • load devtools extension: hacky, needs to be done via support of chrome.devtools APIs
  • (outside chrome-extension.js): serve chrome-extension://* in engine/protocol

These responsibilities could be split into several modules.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions