Skip to content

Convert "Create a DevTools extension" to sample-based#3616

Open
mikehoffms wants to merge 46 commits into
mainfrom
user/mikehoffms/devtools-extension
Open

Convert "Create a DevTools extension" to sample-based#3616
mikehoffms wants to merge 46 commits into
mainfrom
user/mikehoffms/devtools-extension

Conversation

@mikehoffms
Copy link
Copy Markdown
Collaborator

@mikehoffms mikehoffms commented Oct 24, 2025

Related PRs:

Overview of PR:

  1. Get started developing an extension
    • New short article (basic extension; not sidebar, not DevTools tool).
    • Leverages Sample: Picture viewer pop-up webpage.
  2. Samples for Microsoft Edge extensions
    • Linked to "GoogleChrome / chrome-extensions-samples" repo.
  3. Develop an extension for the Microsoft Edge sidebar
    • Updated per upstream.
      • Added sync comments, to facilitate maintenance.
    • Clearly linked to 5 Google samples.
  4. Create a DevTools extension, adding a custom tool tab and panel - broke out as 2 articles:
    • Add a custom tool in Microsoft Edge DevTools
    • Sample: Custom DevTools tool
      • Removed wording about creating that sample (as phase 3 & phase 4, two different versions of the sample).
  5. Trimmed leading spaces in lists, globally in repo.

Rendered articles for review:


Incidental:

AB#55086309

@mikehoffms mikehoffms changed the title Standardize "Sample: Custom DevTools tool tab and panel" Break into 3 "Create a DevTools extension, adding a custom tool tab and panel" Oct 28, 2025
@mikehoffms mikehoffms changed the title Break into 3 "Create a DevTools extension, adding a custom tool tab and panel" Break into 3 "Create a DevTools extension, adding custom tool" Oct 28, 2025
@mikehoffms mikehoffms changed the title Break into 3 "Create a DevTools extension, adding custom tool" Break out "Sample: Custom DevTools tool" from "Create a DevTools extension" Oct 29, 2025
@mikehoffms mikehoffms changed the title Break out "Sample: Custom DevTools tool" from "Create a DevTools extension" Break out "Custom DevTools sample" from "Create DevTools extension" Oct 29, 2025
Update and reorganize documentation for the Custom DevTools tool sample and related getting-started content. Changes include:

- Bumped ms.date to 2026-04-20 in multiple extension docs.
- Reworked microsoft-edge/extensions/developer-guide/devtools-extension.md: clarified the relationship between the guide and samples, reorganized file overview (manifest, panel, devtools.html, devtools.js, background.js, content_script.js, icon.png), added sibling links to sample and code, refined wording and added TODO notes.
- Simplified microsoft-edge/extensions/getting-started/index.md intro and updated date.
- Updated microsoft-edge/extensions/samples/custom-devtools-tool-code.md: revised description, date, sibling markers, clarified devtools.html wording and file list entries.
- Updated microsoft-edge/extensions/samples/custom-devtools-tool.md: updated date, sibling links, added GitHub repo links and rearranged 'See also' / Tools references.

Overall this commit improves clarity, linking between guide/sample/code, and consistency of file descriptions.
Comment thread microsoft-edge/extensions/developer-guide/devtools-extension.md
Comment thread microsoft-edge/extensions/developer-guide/sidebar.md Outdated
Comment thread microsoft-edge/extensions/developer-guide/sidebar.md Outdated
Comment thread microsoft-edge/extensions/developer-guide/sidebar.md Outdated
Comment thread microsoft-edge/extensions/developer-guide/sidebar.md Outdated
Comment thread microsoft-edge/extensions/samples/custom-devtools-tool-code.md Outdated
Comment thread microsoft-edge/extensions/samples/custom-devtools-tool-code.md Outdated
Comment thread microsoft-edge/extensions/samples/custom-devtools-tool-code.md Outdated
Comment thread microsoft-edge/extensions/samples/custom-devtools-tool-code.md Outdated
Comment thread microsoft-edge/extensions/samples/custom-devtools-tool-code.md Outdated
@learn-build-service-prod
Copy link
Copy Markdown
Contributor

Learn Build status updates of commit ee7b11d:

✅ Validation status: passed

File Status Preview URL Details
CODE_OF_CONDUCT.md ✅Succeeded
CONTRIBUTING.md ✅Succeeded
microsoft-edge/accessibility/build/index.md ✅Succeeded View
microsoft-edge/accessibility/design.md ✅Succeeded View
microsoft-edge/accessibility/index.md ✅Succeeded View
microsoft-edge/accessibility/test.md ✅Succeeded View
microsoft-edge/develop-web-microsoft-edge.md ✅Succeeded View
microsoft-edge/developer/index.yml ✅Succeeded View
microsoft-edge/devtools/network-request-blocking/network-request-blocking-tool.md ✅Succeeded View
microsoft-edge/devtools/overview.md ✅Succeeded View
microsoft-edge/devtools/performance-monitor/performance-monitor-tool.md ✅Succeeded View
microsoft-edge/devtools/performance/index.md ✅Succeeded View
microsoft-edge/devtools/performance/reference.md ✅Succeeded View
microsoft-edge/devtools/progressive-web-apps/index.md ✅Succeeded View
microsoft-edge/devtools/quick-source/quick-source-tool.md ✅Succeeded View
microsoft-edge/devtools/recorder/index.md ✅Succeeded View
microsoft-edge/devtools/remote-debugging/index.md ✅Succeeded View
microsoft-edge/devtools/remote-debugging/surface-duo-emulator.md ✅Succeeded View
microsoft-edge/devtools/remote-debugging/webviews.md ✅Succeeded View
microsoft-edge/devtools/remote-debugging/windows.md ✅Succeeded View
microsoft-edge/devtools/rendering-tools/index.md ✅Succeeded View
microsoft-edge/devtools/rendering-tools/js-runtime.md ✅Succeeded View
microsoft-edge/devtools/resources/index.md ✅Succeeded View
microsoft-edge/devtools/samples/index.md ✅Succeeded View
microsoft-edge/devtools/search/search-tool.md ✅Succeeded View

This comment lists only the first 25 files in the pull request.
For more details, please refer to the build report.

Comment thread microsoft-edge/extensions/developer-guide/devtools-extension.md Outdated
Comment thread microsoft-edge/extensions/developer-guide/devtools-extension.md Outdated
Comment thread microsoft-edge/extensions/developer-guide/devtools-extension.md Outdated
Comment thread microsoft-edge/extensions/developer-guide/devtools-extension.md Outdated
Comment thread microsoft-edge/extensions/developer-guide/devtools-extension.md Outdated
Comment thread microsoft-edge/extensions/developer-guide/devtools-extension.md Outdated
Comment thread microsoft-edge/extensions/developer-guide/devtools-extension.md Outdated
Comment thread microsoft-edge/extensions/developer-guide/devtools-extension.md Outdated
Comment thread microsoft-edge/extensions/developer-guide/devtools-extension.md Outdated
Comment thread microsoft-edge/extensions/developer-guide/devtools-extension-sample.md Outdated
@learn-build-service-prod
Copy link
Copy Markdown
Contributor

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

@learn-build-service-prod
Copy link
Copy Markdown
Contributor

Learn Build status updates of commit bb1eee7:

✅ Validation status: passed

File Status Preview URL Details
CODE_OF_CONDUCT.md ✅Succeeded
CONTRIBUTING.md ✅Succeeded
microsoft-edge/accessibility/build/index.md ✅Succeeded View
microsoft-edge/accessibility/design.md ✅Succeeded View
microsoft-edge/accessibility/index.md ✅Succeeded View
microsoft-edge/accessibility/test.md ✅Succeeded View
microsoft-edge/develop-web-microsoft-edge.md ✅Succeeded View
microsoft-edge/developer/index.yml ✅Succeeded View
microsoft-edge/devtools/network-request-blocking/network-request-blocking-tool.md ✅Succeeded View
microsoft-edge/devtools/overview.md ✅Succeeded View
microsoft-edge/devtools/performance-monitor/performance-monitor-tool.md ✅Succeeded View
microsoft-edge/devtools/performance/index.md ✅Succeeded View
microsoft-edge/devtools/performance/reference.md ✅Succeeded View
microsoft-edge/devtools/progressive-web-apps/index.md ✅Succeeded View
microsoft-edge/devtools/quick-source/quick-source-tool.md ✅Succeeded View
microsoft-edge/devtools/recorder/index.md ✅Succeeded View
microsoft-edge/devtools/remote-debugging/index.md ✅Succeeded View
microsoft-edge/devtools/remote-debugging/surface-duo-emulator.md ✅Succeeded View
microsoft-edge/devtools/remote-debugging/webviews.md ✅Succeeded View
microsoft-edge/devtools/remote-debugging/windows.md ✅Succeeded View
microsoft-edge/devtools/rendering-tools/index.md ✅Succeeded View
microsoft-edge/devtools/rendering-tools/js-runtime.md ✅Succeeded View
microsoft-edge/devtools/resources/index.md ✅Succeeded View
microsoft-edge/devtools/samples/index.md ✅Succeeded View
microsoft-edge/devtools/search/search-tool.md ✅Succeeded View

This comment lists only the first 25 files in the pull request.
For more details, please refer to the build report.


1. In DevTools, in the **Activity Bar**, select the **Console** (![Console icon](./devtools-extension-sample-images/console-icon.png)) tool.

The message "Connected!" is displayed in the **Console** tool.<!-- todo: true? how can we view that message? -->
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how view message?


1. Navigate to the `/Demos-main/devtools-extension/` folder, such as `C:\Users\localAccount\GitHub\Demos-main\devtools-extension\`, and then click the **Select Folder** button.<!-- actually used forked cloned /Demos/ dir, a working branch, which has latest version of sample -->

A dialog opens, asking whether to open the repo in the parent folder.<!-- todo: does the dialog open even if when working from the downloaded zip? doesn't this dialog only appear when working off of the cloned repo? -->
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does the dialog open even if when working from the downloaded zip?
doesn't this dialog only appear when working off of the cloned repo?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably not wwhen .zipdl'd.

| `devtools.html` | A non-rendered HTML file that's run when DevTools is opened, to load the extension's JavaScript files. |
| `devtools.js` | Main logic for the custom DevTools page. |
| `service-worker.js` | A service worker that sets up event listeners for communications between the inspected page and DevTools. |
| `content_script.js` | Code which the extension injects in the inspected webpage. Prints a message<!-- todo: what message? --> to the console when the script is injected in the page. Adds a click event listener to the page that will send a message with mouse-click position in the inspected page. |
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What message?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing happens WHEN the script is injected.

when page is clicked, the message appears in console: "Received response"
response => { console.log("Received response", response); }
and also in custom tool, the coordinates of click are printed.


1. Click the **Say Hello to The Inspected Page!** button.
This file does the following:
* Prints a message<!-- todo: what message? --> to the DevTools **Console** when the page is clicked.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prints what message?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seq:

  1. msg is sent from content_script.js, received by devtools.js.
  2. displays the coordinates in the custome tool in devtools, in panel.html
  3. reply from devtools.js is received by content_script.js.
  4. prints to console: console.log("Received response", response); to the console
image

| `devtools.html` | A non-rendered HTML file that's run when DevTools is opened, to load the extension's JavaScript files. |
| `devtools.js` | Main logic for the custom DevTools page. |
| `service-worker.js` | A service worker that sets up event listeners for communications between the inspected page and DevTools. |
| `content_script.js` | Code which the extension injects in the inspected webpage. Prints a message<!-- todo: what message? --> to the console when the script is injected in the page. Adds a click event listener to the page that will send a message with mouse-click position in the inspected page. |
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `content_script.js` | Code which the extension injects in the inspected webpage. Prints a message<!-- todo: what message? --> to the console when the script is injected in the page. Adds a click event listener to the page that will send a message with mouse-click position in the inspected page. |
| `content_script.js` | Code which the extension injects in the inspected webpage. Adds a click event listener to the page that will send a message with the mouse-click position in the inspected page. Sends a message to ... |

sends a message, and devtools.js is listenging for that message as foolows:

chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
    // Messages from content scripts should have sender.tab set.
    if (sender.tab && request.click == true) {
        console.log('I am here!');
        if (youClickedOn) {
            youClickedOn.innerHTML = `(${request.xPosition}, ${request.yPosition})`;
        }
        sendResponse({
            xPosition: request.xPosition,
            yPosition: request.yPosition
        });
    }
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cat: extensions Extensions-related content.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants