<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>38676</bug_id>
          
          <creation_ts>2010-05-06 13:09:02 -0700</creation_ts>
          <short_desc>Web Inspector: make Web Inspector source code more &quot;modular&quot;</short_desc>
          <delta_ts>2014-12-12 14:08:42 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Web Inspector (Deprecated)</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Patrick Mueller">pmuellr</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>bweinstein</cc>
    
    <cc>joepeck</cc>
    
    <cc>keishi</cc>
    
    <cc>pfeldman</cc>
    
    <cc>pmuellr</cc>
    
    <cc>rik</cc>
    
    <cc>yurys</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>221905</commentid>
    <comment_count>0</comment_count>
    <who name="Patrick Mueller">pmuellr</who>
    <bug_when>2010-05-06 13:09:02 -0700</bug_when>
    <thetext>Based on Bug 38672, Comment 1.

Ideas?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>221911</commentid>
    <comment_count>1</comment_count>
    <who name="Pavel Feldman">pfeldman</who>
    <bug_when>2010-05-06 13:19:50 -0700</bug_when>
    <thetext>I&apos;d support the following plan:
Create a new front-end-2 folder. Move JavaScript classes from the original folder into this new folder once they conform to the following requirements:

- class depends only on classes from front-end-2
- it enumerates its dependencies declaratively, as in closure library or similarly (http://code.google.com/closure/library/samples/notepad.js)
- class defines public api using functions not starting with _
- class is &quot;compiler-ready&quot; (i.e. does not mix foo.bar with foo[&quot;bar&quot;], etc.). this might require stopping using getters and setters since minifiers / compilers do not support them well.
- class belongs to a meaningful namespace (namespace per panel)
- there are no dependencies between panel namespaces (i.e. class that belongs to elements panel can not explicitly depend on class that belongs to resources, they should interact using extension points / services / indirections defined by the platform).
I might add stuff here...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>221916</commentid>
    <comment_count>2</comment_count>
    <who name="Timothy Hatcher">timothy</who>
    <bug_when>2010-05-06 13:23:25 -0700</bug_when>
    <thetext>Keeping getters and setters is a hard requirement for me.

Why is a compiler needed?

Tell the compilers to get with the program.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>221917</commentid>
    <comment_count>3</comment_count>
    <who name="Patrick Mueller">pmuellr</who>
    <bug_when>2010-05-06 13:24:35 -0700</bug_when>
    <thetext>One thought I&apos;ve had is to create a set of functions to make it easier to build our classes.

Here&apos;s the typical pattern, from ConsolePanel:

    WebInspector.ConsolePanel = function()
    {
        WebInspector.Panel.call(this);
    }

    WebInspector.ConsolePanel.prototype = {
    ...
    }

    WebInspector.ConsolePanel.prototype.__proto__ = WebInspector.Panel.prototype;

I suspect we could create some functions to help with this.  They would be useful should something happen like we find we can&apos;t use the non-standard __proto__ property in the future.

    defClass(function ConsolePanel() {
        $super(this);
    })

    setSuperclass(Panel)

    defMethod(function someInstanceMethod() {

    })

    defStaticMethod(function someStaticMethod() {

    })

I&apos;ve built such things in the past, with a bunch of different shapes.  I find these read better than all the boilerplate that folks typically use.  I also happen to dislike throwing all the prototype functions inside a literal object, so that you have to deal with commas between elements, etc.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>221920</commentid>
    <comment_count>4</comment_count>
    <who name="Timothy Hatcher">timothy</who>
    <bug_when>2010-05-06 13:27:06 -0700</bug_when>
    <thetext>Please, no. That is far from the easy to read syntax we have. It is more code/typing too…</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>221923</commentid>
    <comment_count>5</comment_count>
    <who name="Patrick Mueller">pmuellr</who>
    <bug_when>2010-05-06 13:29:46 -0700</bug_when>
    <thetext>In terms of organizing the existing source files, perhaps looking at CommonJS would be good.  There are a small handful of browser-based impls; we could certainly roll our own - getting the basics right isn&apos;t a big deal.  This will help with the pre-req problem.  I think there&apos;s probably some overlap between closure and CommonJS require(), but CommonJS is getting a lot of interest at the moment.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>221924</commentid>
    <comment_count>6</comment_count>
    <who name="Pavel Feldman">pfeldman</who>
    <bug_when>2010-05-06 13:30:00 -0700</bug_when>
    <thetext>(In reply to comment #2)
&gt; Keeping getters and setters is a hard requirement for me.
&gt; 

I know.

&gt; Why is a compiler needed?
&gt; 

To minify the code and do the type checking if we get that far.

&gt; Tell the compilers to get with the program.

Fair enough.

(In reply to comment #3)
&gt; I&apos;ve built such things in the past, with a bunch of different shapes.  I find
&gt; these read better than all the boilerplate that folks typically use.  I also
&gt; happen to dislike throwing all the prototype functions inside a literal object,
&gt; so that you have to deal with commas between elements, etc.

Original code reads better for me. That&apos;s why I mentioned closure style - it
looks pretty much the same way as existing code + provides the tooling you are
talking about. But...

It is really easy to stuck at this point in the &quot;choosing the right framework&quot;
phase, so I&apos;d suggest that we do it step by step, leaving existing code
structure in place and fighting dependencies as a start...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>221934</commentid>
    <comment_count>7</comment_count>
    <who name="Timothy Hatcher">timothy</who>
    <bug_when>2010-05-06 13:39:10 -0700</bug_when>
    <thetext>I&apos;d rather not require a framework. I could agree on a compilier that supported our structure though.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1055092</commentid>
    <comment_count>8</comment_count>
    <who name="Brian Burg">burg</who>
    <bug_when>2014-12-12 14:08:42 -0800</bug_when>
    <thetext>Closing as invalid, as this bug pertains to the old inspector UI and/or its tests.
Please file a new bug (https://www.webkit.org/new-inspector-bug) if the bug/feature/issue is still relevant to WebKit trunk.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>