Both the Style Inspctor and GCLI use the same template engine, but different copies of it

VERIFIED FIXED

Status

()

Firefox
Developer Tools
VERIFIED FIXED
6 years ago
5 years ago

People

(Reporter: jwalker, Assigned: jwalker)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [best:1d, likely:1d, worst:2d])

Comment hidden (empty)
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
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/
If only we had Harmony modules, this would be easy ....
why can't you use the JSM?
(In reply to comment #4)
> why can't you use the JSM?

Because gcli is also used in other web apps (such as ace).
(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...
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.
That seems best to me, for sure.
Assignee: nobody → jwalker
Whiteboard: [minotaur][best:1d, likely:1d, worst:2d]
Blocks: 659052
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.
Thanks Mike - please tell me when I can sync up.
Okay ... I will move it to devtools/shared and let you know when Dolske approves the patch.
Summary: Both the Style Inspctor and GCLI use the same template engine, but difference copies of it → Both the Style Inspctor and GCLI use the same template engine, but different copies of it

Updated

6 years ago
Whiteboard: [minotaur][best:1d, likely:1d, worst:2d] → [best:1d, likely:1d, worst:2d]
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Status: RESOLVED → VERIFIED
No longer blocks: 659052
You need to log in before you can comment on or make changes to this bug.