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

Devtools cleanup #145

Open
wants to merge 57 commits into
base: dev
Choose a base branch
from
Open

Devtools cleanup #145

wants to merge 57 commits into from

Conversation

dkrasner
Copy link
Contributor

Motivation and Context

This PR represent a refactoring and cleanup of the devtools extension. Previous there were a number of drawbacks:

  1. The devtools panel <-> background <-> content script port communication API was convoluted. I found it confusing and hard to debug each time.
  2. using inspectedWindow.eval() for devtools panel -> cells was awkward, hard to debug and potentially dangerous
  3. handling of messages from, and sending data to, devtools was using a combination of ports, window message api and eval()

Approach

Ports are not cleanly defined in both background and content scripts.

Wherever possible the content script handles messages itself, ie it has its own set of utils which do not depend on the cells themselves. For example, mouseover type highlighting for cells only requires the DOM document query API and should be handled by CellHandler as before. Only in the case that something from Cells itself is strictly necessary (for example getting a cell nodes source code) is the window message API used.

This PR can close previous #139 and #140

How Has This Been Tested?

In devtools. The Tree lib has its own tests.

Screenshots or console output (if appropriate)

image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • [] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

manifest, devtools html/js, cells_panel html/js
organizing code into module
updating some css
with png
and minor changes
initial load, reconnection displays
setup for cells loadeded displays
fixing up id class for d3 nodes and cells
adding tests for the tree component
first pass at bezier curves for connectors
prepending "node-" to each DOM element id
keeping the original id in "data-original-id" attribute
fixing up navigation bugs
when tree nodes are (almost) vertically aligned, use a basic svg path line
instead of a bezier curve
adding hover (mouseover mouseleave) handling on the target window object and
corresponding no-op methods to tree
setup these methods
click handler display node data in the info panel
customization performs additional highlighting
looks like a weird race condition
cleaner setup for content-script <-> background
background <-> panel/devtools window port API
moving forward the background will not use the direct inspected window
eval() - which is a) awkward and b) can have security issues. All communication
from the cells panel routes via the background, to the content script which then
handles messages as needed (either directly executing utils or sending messages
via the window message api)
@dkrasner dkrasner requested a review from braxtonmckee June 19, 2023 12:10
This was referenced Jun 19, 2023
@dkrasner dkrasner mentioned this pull request Aug 7, 2023
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant