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 Iframe Support #21

Merged
merged 4 commits into from Nov 4, 2021
Merged

Add Iframe Support #21

merged 4 commits into from Nov 4, 2021

Conversation

gwwar
Copy link
Owner

@gwwar gwwar commented Nov 3, 2021

Fixes #5

Previously when selecting elements in child frames, z-context would not be able to report any information, changes in this PR make is so that we should be able to see stacking contexts on any child iframes.

CleanShot.2021-11-03.at.15.01.56.mp4

Docs are extremely slim here, so this took quite a bit of experimentation. I finally found a decent solution to this. No idea on if this will pass for app review though.

The basic idea is that we also add a content_script.js which is injected in all child pages and iframes. We still have our devtools page, and also a background page to passthrough messages from the content script to the devtools page or vice versa.

After we create a sidebar panel, we tell the content scripts to message back the extension with their current urls.

We can then subscribe to dev tools change events with the right url

// register with the correct frame url
chrome.devtools.panels.elements.onSelectionChanged.addListener(
	() => {
		chrome.devtools.inspectedWindow.eval("setSelectedElement($0)", { useContentScriptContext: true, frameURL: msg.iframe } );
	}
);

TODO

@gwwar gwwar self-assigned this Nov 3, 2021
@gwwar
Copy link
Owner Author

gwwar commented Nov 4, 2021

Adding a few updated resources

z-context

z-context

@gwwar gwwar merged commit 486e5c6 into master Nov 4, 2021
@gwwar gwwar deleted the try/iframe-support branch November 4, 2021 22:06
@gwwar
Copy link
Owner Author

gwwar commented Nov 10, 2021

Note that the "tabs" permission is unneeded. See #22

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.

Add Ability to Inspect Iframes
1 participant