Last Comment Bug 669486 - Both the Style Inspctor and GCLI use the same template engine, but different copies of it
: Both the Style Inspctor and GCLI use the same template engine, but different ...
Status: VERIFIED FIXED
[best:1d, likely:1d, worst:2d]
:
Product: Firefox
Classification: Client Software
Component: Developer Tools (show other bugs)
: unspecified
: All All
: -- normal (vote)
: ---
Assigned To: Joe Walker [:jwalker] (needinfo me or ping on irc)
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-07-05 15:11 PDT by Joe Walker [:jwalker] (needinfo me or ping on irc)
Modified: 2012-01-13 10:37 PST (History)
4 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments

Description Joe Walker [:jwalker] (needinfo me or ping on irc) 2011-07-05 15:11:59 PDT

    
Comment 1 Joe Walker [:jwalker] (needinfo me or ping on irc) 2011-07-06 06:20:15 PDT
Here's what I think we need to do:
- Tweak it so the implementation is static
  (i.e. a single function or set of functions)
- Move it out into a JSM
- Have the Style Inspector import it
- For GCLI:
  - Tweak dryice to allow several implementation of the same module
  - Create a new templater module that just defers to a JSM
  - Ensure that we can package a built in templater for html
    and the proxied one for firefox
- Ensure the in-tree version is commented to point out the other
  versions of the same code
Comment 2 Michael Ratcliffe PTO -> Fri, 24 Jun 2016 [:miker] [:mratcliffe] 2011-07-06 06:34:07 PDT
In my naivety I thought that once the templater was in a JSM both tools could import and use it. I guess the GCLI is a special case :o/
Comment 3 Joe Walker [:jwalker] (needinfo me or ping on irc) 2011-07-06 06:44:00 PDT
If only we had Harmony modules, this would be easy ....
Comment 4 Rob Campbell [:rc] (:robcee) 2011-07-06 06:54:03 PDT
why can't you use the JSM?
Comment 5 Nick Fitzgerald [:fitzgen] [⏰PDT; UTC-7] 2011-07-06 10:34:12 PDT
(In reply to comment #4)
> why can't you use the JSM?

Because gcli is also used in other web apps (such as ace).
Comment 6 Nick Fitzgerald [:fitzgen] [⏰PDT; UTC-7] 2011-07-06 10:39:17 PDT
(In reply to comment #1)
> Here's what I think we need to do:
> - Tweak it so the implementation is static
>   (i.e. a single function or set of functions)
> - Move it out into a JSM
> - Have the Style Inspector import it
> - For GCLI:
>   - Tweak dryice to allow several implementation of the same module
>   - Create a new templater module that just defers to a JSM
>   - Ensure that we can package a built in templater for html
>     and the proxied one for firefox
> - Ensure the in-tree version is commented to point out the other
>   versions of the same code

Or just have the Firefox dryice build ignore the templater requirement, and have a check in the code like this:

var DomTemplate = require('path/to/dom-template');
if (!DomTemplate) {
  if (typeof Components === 'object'
      && typeof Components.utils === 'object'
      && typeof Components.utils.import === 'funciton') {
    Components.utils.import('resource:///path/to/dom-template');
  } else {
    throw new Error('blah blah blah');
  }
}

Not sure if that is cleaner though...
Comment 7 Joe Walker [:jwalker] (needinfo me or ping on irc) 2011-07-06 11:22:19 PDT
Or half way:
- Have dryice ignore the templater requirement
- Add to prefix-gcli.jsm:

var x = {};
Components.utils.import('resource:///path/to/dom-template', x);
define('path/to/dom-template', [], function(exports) {
  exports.DomTemplate = x.DomTemplate;
});

That way all the client code can just import and be done.
Comment 8 Nick Fitzgerald [:fitzgen] [⏰PDT; UTC-7] 2011-07-06 12:26:51 PDT
That seems best to me, for sure.
Comment 9 Michael Ratcliffe PTO -> Fri, 24 Jun 2016 [:miker] [:mratcliffe] 2011-08-03 11:44:22 PDT
Joe: I have already moved DOM Templater into a jsm as part of bug 582596. I will submit the new patch in the next couple of days.
Comment 10 Joe Walker [:jwalker] (needinfo me or ping on irc) 2011-08-05 07:50:47 PDT
Thanks Mike - please tell me when I can sync up.
Comment 11 Michael Ratcliffe PTO -> Fri, 24 Jun 2016 [:miker] [:mratcliffe] 2011-08-05 10:31:23 PDT
Okay ... I will move it to devtools/shared and let you know when Dolske approves the patch.

Note You need to log in before you can comment on or make changes to this bug.