GithubHelp home page GithubHelp logo

joewalker / devtools-window Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mozilla/mozilla-central

4.0 4.0 5.0 1.11 GB

A git clone of mozilla-central, with full history.

Home Page: http://mozilla.org/

License: Other

C++ 41.63% Objective-C 1.30% C 28.61% JavaScript 20.85% Python 2.89% Shell 0.78% PowerShell 0.01% Perl 0.23% Java 2.22% Scilab 0.01% XML 0.01% Awk 0.01% Assembly 1.43% Ragel in Ruby Host 0.01% D 0.01% Emacs Lisp 0.01% MATLAB 0.02% Ruby 0.01% Component Pascal 0.01% Scala 0.02%

devtools-window's People

Contributors

asurkov avatar benturner avatar bhackett1024 avatar bholley avatar brendaneich avatar bsmedberg avatar bzbarsky avatar daogottwald avatar dbaron avatar dholbert avatar ehsan avatar gavinsharp avatar glandium avatar jfkthame avatar joneschrisg avatar jswalden avatar mak77 avatar mbrubeck avatar mfinkle avatar mossop avatar mounirlamouri avatar mrbkap avatar ms2ger avatar nnethercote avatar philor avatar reedloden avatar rocallahan avatar sayrer avatar sdwilsh avatar vvuk avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

devtools-window's Issues

Use `ToolDefinition.isTargetSupported`

Before building a tab for a tool, the Toolbox should call isTargetSupport(aTarget). If this function return false, the tab should be disabled (visible, but grey).

For example, we should not build a tab for the StyleEditor if the target is not TAB.

Improve JSMs memory consumption

We define panels in JSMs. Most of these JSMs happen to also include the implementation of the tool.

That means a lot of tools-related JS code is loaded early and everytime Firefox is started, even if the user won't use the tools.

We should split implementation and definitions, and dynamically (or lazily) import the implementation JSMs (from the build function).

Improve devtools.jsm

  • support of the killswitch (if a tool is disabled, it should not be listed in getToolDefinitions. Or maybe we should have a getActiveToolDefinitions method)
    Mike: getToolDefinitions will be fine as getActiveToolDefinitions would be confusing.
  • Remove this._listeners references
  • Use new EventEmitter(this); (see pull #17)
  • registerTool and unregisterTool should notify all the Toolboxes (aToolBox.emit("tool(un)registered", aToolID))
  • openToolbox should return the toolbox instance
  • remove DevToolInstance.show / DevToolInstance.hide

Handle Target switching

We should be able to change the target of a toolbox (on the API and implementation side).

Style Editor should survive a reload

Now that the tools target tabs and not the top level content window, we need to ensure that it can handle a tab reload.

The Web Console and the Debugger have been designed this way, but not the Inspector and the Style Editor.

`selectTool` should check first if the Toolbox is loaded

We can call selectTool even-though the Toolbox is not loaded. It should throw an exception: "Toolbox is not ready. Wait for the ready event" (or something like that).

Otherwise, it breaks:

[JavaScript Error: "TypeError: tabstrip is null"
{file: "resource:///modules/devtools/Toolbox.jsm" line: 302}]

Implement gDevTools.getPanelForTarget("aToolName", "aTargetValue")

This is a helper. What it basically does:

    gDevTools.getPanelForTarget("jsdebugger", gBrowser.selectedTab);
   getPanelForTarget: function(aToolName, aTargetValue) {
      let toolbox = gDevTools.getToolboxes().get(targetValue);
      if (!toolbox) {
        return undefined;
      }
      return toolbox.getToolPanels().get("jsdebugger");
   }

Emit "ready" and "{tool}-ready" events

Once a tool is ready, it should emit a ready event. The toolbox should then emit a {toolId}-ready event.

I will take care of that as it affects the inspector.

Each tool should emit such event. Also, the tools should expose a property named isReady.

Begin l10n

Just some basic stuff but a start all the same

add the code for a Tool class to devtools.jsm

Something like this:

Tool {
display visibility;
string name;
url icon;
targetChanged(???)
ctor(url)
freeze();
thaw();
destroy()
}

(i don't think we care about official js for now)

Finish GCLI button toolbar

The code needs tidying up (and probably extracting somewhere)

We need to finish off the icons

We need to decide on a default set of commands

Implement the toolbox basis

First thing to do is to dynamically append an <iframe> to the .browserContainer or the notificationbox (see http://mxr.mozilla.org/mozilla-central/source/browser/base/content/tabbrowser.xml#24).

The iframe will load a about:devtools document (we don't have to handle this specific URL for now, we can use a simple chrome:// URL).

I think we should use XUL for this document.

This first version of the toolbox should have:

To retrieve information about the existing tools, the toolbox should use the gDevTools API.

for (let def of gDevTools.getToolDefinitions()) {
  // build the UI for one tab (just the button)
  // start the tool only when the tab is clicked
  tab.onclick = function() {
     def.build();
  }
}

The toolbox should expose the API described in this document: https://etherpad.mozilla.org/devtools-framework-jsm

Events that could be sent:

  • toolReady,
  • toolHide,
  • toolShow,
  • toolClosed
  • toolBoxReady
  • toolBoxClosed

(we want to use a generic event emitter mechanism: https://bugzilla.mozilla.org/show_bug.cgi?id=723904)

To simplify the development of the Toolbox, I suggest that we use a fake gDevTools object that could be loaded beforehand via Scratchpad. We would also need 2 fake tools that we could load also via Scratchpad. Opening the toolbox will also happen from the Scratchpad. See https://gist.github.com/3697858

See issue #8 for the gDevTools part.

A toolbox for a tab is started this way:

gDevTools.openToolbox(aTarget, aHost, aDefaultToolId); // aTarget being the tab

It's gDevTools job to ensure that only one Toolbox is open per target.

Pressing Escape should close the toolbox

This might need to be discussed with UX people, but the same way Escape closes the Inspector in Firefox current, we'd like Escape to close the toolbox. It makes sense for the inspector, but also for the debugger (Rob said so).

This might sound fragile, but if we implement a cancellable mechanism to close the toolbox that is paired with the notification box, that would work.

How do we handle keybindings?

I see 3 options:

  1. A tool definition exposes a keybinding. When a tool is registered, we add a <key> tag to browser.xul. Pros: It's generic and keeps the tools isolated (no need to invade browser/base). Cons: Every time a Firefox window is open, those DOM element have to be created. That might have some performance impact.
  2. No dynamic code. A <key> tag is added in browser-set.inc (as it is right now). Pros: No perf problem. Cons: Not generic (addons can't use it). Tools are not confined in browser/devtools.
  3. No keybinding per tool. One single keybinding (Ctrl-shift-K) to start the toolbox, and from there, the user select the tool. Pros: implementation is simple. No perf issue. Mechanism is consistent for the builtin-tools and addons. No need to worry about findings keybindings for every new tools. Cons: It might disturb existing users. Path to a tool might be longer (but we would be smart about it, and show the latest used tool).

Personally, I'm for 3).

Add tests for the new activation workflow

  • Open / Close Toolbox
  • Open individual tools when toolbox open
  • Open individual tools when toolbox closed

We can just check which tab's checkbox is checked as tool initialization checks are each tools responsibility.

TypeError: window.DeveloperToolbar.display is undefined

Getting this error when opening the devtools toolbox (on the "toolbox" branch):

Error: TypeError: window.DeveloperToolbar.display is undefined
Source File: resource:///modules/devtools/gDevTools.jsm
Line: 259

The line in question is:

  var requisition = window.DeveloperToolbar.display.requisition;

in createButtons()

Handle Target life time

When a target is about the get destroyed (on tab close for example), we should notify the Toolbox, and let the toolbox cancel the destruction if needed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.