Convert Figma logo to code with AI

firefox-devtools logodebugger

The faster and smarter Debugger for Firefox DevTools 🔥🦊🛠

4,614
759
4,614
0

Top Related Projects

Read-only Git mirror of the Mercurial gecko repositories at https://hg.mozilla.org. How to contribute: https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html

A DAP-compatible JavaScript debugger. Used in VS Code, VS, + more

The Chrome DevTools UI

162,288

Visual Studio Code

7,948

Home of the WebKit project, the browser engine used by Safari, Mail, App Store and many other applications on macOS, iOS and Linux.

106,466

Node.js JavaScript runtime ✨🐢🚀✨

Quick Overview

The firefox-devtools/debugger repository is the home of the Firefox Debugger, a powerful tool for debugging JavaScript in Firefox. It provides developers with features to inspect, analyze, and debug web applications directly within the browser, offering a seamless debugging experience for Firefox users.

Pros

  • Integrated directly into Firefox, providing a native debugging experience
  • Supports modern JavaScript features and frameworks
  • Offers a rich set of debugging tools, including breakpoints, call stack inspection, and variable watching
  • Open-source project with active community involvement

Cons

  • Limited to Firefox browser, not usable in other browsers
  • May have a steeper learning curve compared to some other browser debugging tools
  • Performance can be impacted when dealing with large-scale applications
  • Occasional synchronization issues between the debugger and the browser

Getting Started

To use the Firefox Debugger:

  1. Open Firefox and navigate to the web page you want to debug.
  2. Press F12 or right-click and select "Inspect Element" to open the Developer Tools.
  3. Click on the "Debugger" tab in the Developer Tools panel.
  4. Set breakpoints in your JavaScript code by clicking on the line numbers.
  5. Refresh the page or trigger the relevant JavaScript to start debugging.

For developers interested in contributing to the Firefox Debugger project:

  1. Fork the repository on GitHub.
  2. Clone your fork: git clone https://github.com/your-username/debugger.git
  3. Install dependencies: yarn install
  4. Start the development server: yarn start
  5. Open Firefox and navigate to about:debugging
  6. Click "This Firefox" and then "Load Temporary Add-on"
  7. Select the manifest.json file in the firefox directory of your cloned repository.

For more detailed instructions, refer to the project's CONTRIBUTING.md file.

Competitor Comparisons

Read-only Git mirror of the Mercurial gecko repositories at https://hg.mozilla.org. How to contribute: https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html

Pros of gecko-dev

  • Larger, more comprehensive codebase covering the entire Firefox browser
  • More active development with frequent commits and updates
  • Broader community involvement and support

Cons of gecko-dev

  • Higher complexity and steeper learning curve for new contributors
  • Longer build times and more resource-intensive development environment
  • More challenging to isolate and work on specific components

Code Comparison

debugger:

export function getSelectedSource(state: OuterState) {
  return state.sources.selectedSource;
}

gecko-dev:

nsresult
nsDocShell::CreateAboutBlankContentViewer()
{
  // Setup principal and document
  nsCOMPtr<nsIPrincipal> principal;
  nsresult rv = GetInheritedPrincipal(getter_AddRefs(principal));
  NS_ENSURE_SUCCESS(rv, rv);
}

The debugger repository focuses on JavaScript-based debugging tools, while gecko-dev encompasses a broader range of languages and components for the entire Firefox browser. The code snippets illustrate the difference in scope and complexity between the two projects.

A DAP-compatible JavaScript debugger. Used in VS Code, VS, + more

Pros of vscode-js-debug

  • More extensive language support, including TypeScript and Node.js
  • Tighter integration with VS Code, offering a seamless debugging experience
  • Regular updates and active maintenance from Microsoft

Cons of vscode-js-debug

  • Limited to VS Code environment, less flexible for other IDEs or browsers
  • Steeper learning curve for users not familiar with VS Code ecosystem

Code Comparison

debugger (Firefox DevTools):

async function getBreakpointPositions(location) {
  const { sourceId } = location;
  const source = getSource(getState(), sourceId);
  if (!source) {
    return [];
  }
  return dispatch(setBreakpointPositions({ sourceId }));
}

vscode-js-debug:

export async function getBreakpointPositions(
  session: DebugSession,
  source: Source,
  range?: Range
): Promise<IPosition[]> {
  const response = await session.sendRequest('breakpointLocations', { source, line: range?.startLineNumber });
  return response.breakpoints.map(bp => ({ lineNumber: bp.line, column: bp.column }));
}

Both repositories focus on JavaScript debugging, but vscode-js-debug is more tightly integrated with VS Code and offers broader language support. The debugger from Firefox DevTools is more flexible for use across different environments but may have a narrower focus on web technologies. The code snippets demonstrate similar functionality for retrieving breakpoint positions, with vscode-js-debug using TypeScript and a more structured approach.

The Chrome DevTools UI

Pros of devtools-frontend

  • Larger community and more frequent updates
  • Extensive documentation and resources
  • Broader feature set and compatibility with Chrome extensions

Cons of devtools-frontend

  • More complex codebase, potentially harder to contribute
  • Heavier resource usage compared to Firefox's debugger
  • Tighter integration with Chrome, potentially limiting cross-browser compatibility

Code Comparison

devtools-frontend:

SDK.TargetManager.instance().observeTargets({
  targetAdded: (target) => {
    if (target.type() === SDK.Target.Type.Frame) {
      this._attachToTarget(target);
    }
  },
  targetRemoved: (target) => {
    this._detachFromTarget(target);
  },
});

debugger:

const { ThreadFront } = require("./thread");

ThreadFront.watchTarget(target => {
  if (target.isTopLevel) {
    this.attachToTarget(target);
  }
});

Both examples show how the debuggers attach to targets, but devtools-frontend uses a more elaborate SDK-based approach, while debugger employs a simpler, more direct method. This reflects the overall complexity difference between the two projects.

162,288

Visual Studio Code

Pros of VS Code

  • Larger and more active community, with frequent updates and extensive plugin ecosystem
  • Multi-language support, not limited to JavaScript debugging
  • More comprehensive IDE features beyond just debugging

Cons of VS Code

  • Heavier resource usage, potentially slower startup times
  • Steeper learning curve due to more complex feature set
  • Less specialized for JavaScript debugging compared to Debugger

Code Comparison

VS Code (launch.json configuration):

{
  "type": "node",
  "request": "launch",
  "name": "Launch Program",
  "program": "${workspaceFolder}/app.js"
}

Debugger (launchConfig.js):

module.exports = {
  name: "Node",
  type: "node",
  request: "launch",
  program: "${workspaceRoot}/app.js"
};

Both repositories provide debugging capabilities, but VS Code offers a more comprehensive development environment with broader language support. Debugger, being more focused on JavaScript debugging within Firefox, may provide a more streamlined experience for that specific use case. VS Code's extensive plugin ecosystem and frequent updates make it highly versatile, while Debugger's specialization could be advantageous for Firefox-specific development. The code comparison shows similar configuration approaches, with VS Code using JSON and Debugger using JavaScript for launch configurations.

7,948

Home of the WebKit project, the browser engine used by Safari, Mail, App Store and many other applications on macOS, iOS and Linux.

Pros of WebKit

  • Larger and more comprehensive codebase, covering the entire WebKit engine
  • Broader community support and contributions from major tech companies
  • More extensive documentation and resources for developers

Cons of WebKit

  • Steeper learning curve due to its size and complexity
  • Slower development cycle for individual features compared to Debugger
  • Potentially more challenging for newcomers to contribute

Code Comparison

WebKit

class JSGlobalObject : public JSSegmentedVariableObject {
public:
    using Base = JSSegmentedVariableObject;
    static constexpr unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable;

    template<typename CellType, SubspaceAccess mode>
    static IsoSubspace* subspaceFor(VM& vm)
    {
        return vm.globalObjectSpace<mode>();
    }
    // ... more code ...
};

Debugger

export function getSelectedSource(state: OuterState) {
  return getCurrentThread(state).sources.selectedSource;
}

export function getSelectedSourceId(state: OuterState) {
  const source = getSelectedSource(state);
  return source && source.id;
}

The WebKit code snippet shows a more complex C++ class definition, while the Debugger code is a simpler JavaScript function. This reflects the difference in scope and complexity between the two projects.

106,466

Node.js JavaScript runtime ✨🐢🚀✨

Pros of Node.js

  • Larger community and ecosystem, with more contributors and third-party packages
  • Broader application scope, suitable for server-side, desktop, and IoT applications
  • More frequent updates and releases, ensuring better security and performance

Cons of Node.js

  • Steeper learning curve due to its extensive features and capabilities
  • Larger codebase, which can be more challenging to navigate for beginners
  • Not specifically designed for debugging, unlike Debugger which is purpose-built

Code Comparison

Node.js (event-driven, non-blocking I/O):

const http = require('http');

const server = http.createServer((req, res) => {
  res.writeHead(200, { 'Content-Type': 'text/plain' });
  res.end('Hello World\n');
});

server.listen(8080);

Debugger (debugging-focused):

const { createSource, getOriginalURLs } = require("devtools/client/debugger/src/utils/source");

const source = createSource({
  url: "http://example.com/file.js",
  contentType: "javascript"
});

const originalURLs = getOriginalURLs(source);

This comparison highlights the different focus areas of the two projects. Node.js is a runtime environment for executing JavaScript, while Debugger is a specialized tool for debugging JavaScript code, particularly in the context of Firefox DevTools.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Firefox Debugger

The Firefox Debugger is now maintained in Mozilla's central repository.

  • Visit docs to learn how to contribute
  • Checkout our dashboard to find good first bugs.
  • Go to bugzilla to report an issue or suggest an enhancement.
  • Feel free to ask questions at any point on Matrix

debugger-screenshot

Thank You

The Firefox Debugger was built in Github for the first 3 years of its development. Over 300+ volunteers contributed thousands of commits and built many of the features we take for granted today.

We hope to continue that spirit today in Mozilla Central. We believe the Debugger can be a great place to collaborate on the next iteration of developer tools. And, that everyone regardless of background or experience can contribute work of significance.