Closed Bug 746124 (cfx.js) Opened 12 years ago Closed 10 years ago

CFX in Javascript

Categories

(Add-on SDK Graveyard :: General, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: ochameau, Unassigned)

References

()

Details

Attachments

(2 files)

Tracking bug in order to follow progress around "CFX in JS" feature:
  https://wiki.mozilla.org/Features/Jetpack/CFX_in_JS

Preliminary discussion happened on etherpad:
  https://jetpack.etherpad.mozilla.org/cfx-js

This work can easily be splitted in multiple, eventually parallel steps:
 - Be able to execute Javascript code hosted in an addon from cfx in python
Then we would be able do implement following CFX workflow steps in JS:
 - Install and execute an Addon
 - Generate the XPI out of the manifest
 - Compute the manifest out of packages/modules
 - Read/seek for packages/modules on filesystem
 - Interpret command line options
 - Build a command line application with mozilla-platform/Firefox
 - Write shell/bash scripts in order to setup cfx environnement (equivalent of source bin/activate)

Depending on which order we are going to land these steps, this work will allow to improve Addon-builder-helper addon by building xpi on client side. Same thing apply if we want to provide a GUI instead of the existing cfx command line interface. 
We can decide that 4 last steps don't really worth it or are less urgent that improving Addon-builder and execute them later on.

All these steps can be analysed and prototyped in parallel, but they will most likely have to land in this order.

Last but not least, we will have to synchronize this work with:
 - packageless feature
 - Addon SDK as an Addon
 - Ship SDK via AMO

Packageless can directly be implemented in JS, it would just require first steps of this work to be landed.
Ship SDK via AMO task can be simplified if we get completely rid of python dependency. We won't have to bootstrap, nor interact with python environnement from an Addon.
Assignee: nobody → poirot.alex
Depends on: 746131
Priority: -- → P1
Assignee: poirot.alex → evold
Assignee: evold → nobody
Commit pushed to master at https://github.com/mozilla/addon-sdk

https://github.com/mozilla/addon-sdk/commit/93aba8720f10d378a6cd5663f87f50df5d031c33
Merge pull request #646 from Gozala/jep/cfx-js

Bug 746124 - Implement nodejs compatible `fs` and `path` modules.
Attachment #762210 - Flags: review?(evold) → review+
Attachment #762424 - Flags: review?(evold) → review+
Commit pushed to master at https://github.com/mozilla/addon-sdk

https://github.com/mozilla/addon-sdk/commit/fe2efc71e3d568b15d4c2c9f24990ca24a82cfee
Merge pull request #1032 from Gozala/jep/cfx-js

Bug 746124 - Fix windows specific issues in FS module. r=@erikvold
So, when this was uplifted in today's merge to mozilla-inbound, the path tests failed on only OSX: https://tbpl.mozilla.org/php/getParsedLog.php?id=24807987&tree=Mozilla-Inbound&full=1#error0

TEST-UNEXPECTED-FAIL | tests/test-path.test path | 
path.resolve("a/b/c/","../../..")
  expect="/builds/slave/talos-slave/test/build/./FirefoxNightlyDebug.app/Contents/MacOS/browser"
  actual="/builds/slave/talos-slave/test/build/FirefoxNightlyDebug.app/Contents/MacOS/browser"
path.resolve(".")
  expect="/builds/slave/talos-slave/test/build/./FirefoxNightlyDebug.app/Contents/MacOS/browser"
  actual="/builds/slave/talos-slave/test/build/FirefoxNightlyDebug.app/Contents/MacOS/browser" - 0 == 2
TEST-INFO | Traceback (most recent call last):
  File "resource://gre/modules/commonjs/sdk/timers.js", line 31, in notify
    callback.apply(null, args);
  File "resource://gre/modules/commonjs/sdk/deprecated/unit-test.js", line 294, in null
    timer.setTimeout(function() { onDone(self); }, 0);
  File "resource://gre/modules/commonjs/sdk/deprecated/unit-test.js", line 470, in null
    options.onDone(self);
  File "resource://gre/modules/commonjs/sdk/deprecated/unit-test.js", line 452, in runNextTest
    self.start({test: test, onDone: runNextTest});
  File "resource://gre/modules/commonjs/sdk/deprecated/unit-test.js", line 483, in start
    this.test.testFunction(this);
  File "resource://gre/modules/commonjs/test.js", line 72, in null
    test(assert);
  File "resource://extensions.modules.f90e1ffb-5306-4834-89d0-b14d5b874846-at-jetpack.commonjs.path.tests/test-path.js", line 235, in exports["test path"]
    assert.equal(failures.length, 0, failures.join(''));
  File "resource://gre/modules/commonjs/sdk/test/assert.js", line 125, in equal
    operator: "=="
  File "resource://gre/modules/commonjs/sdk/test/assert.js", line 89, in fail
    this._log.fail(message);
  File "resource://gre/modules/commonjs/sdk/deprecated/unit-test.js", line 84, in fail
    this.console.testMessage(false, false, this.test.name, message);
  File "resource://gre/modules/commonjs/sdk/test/harness.js", line 523, in testMessage
    this.trace();

Not sure why it only failed on inbound and not the Jetpack tree, though...
Flags: needinfo?(rFobic)
At a guess this is a bug that only occurs when using the modules in Firefox
Commit pushed to master at https://github.com/mozilla/addon-sdk

https://github.com/mozilla/addon-sdk/commit/398f7e7e6afea2194dafa440dac0178744f0b7ca
Merge pull request #1080 from Gozala/hotfix/path

Bug 746124 - Pull updates for path module from upstream node.
So, the try run looked pretty green, so I merged that pull request to master up in comment 8.

The Jetpack tree's tests then ran, and came back all orange: https://tbpl.mozilla.org/?tree=Jetpack&rev=0f7d8b1df10d

TBPL's parser isn't catching the error, but it's down near the bottom of the logs:
Testing all packages...
Testing all available packages: /builds/slave/talos-slave/test/addonsdk-poller/addon-sdk-0f7d8b1df10d.
Testing /builds/slave/talos-slave/test/addonsdk-poller/addon-sdk-0f7d8b1df10d...
Traceback (most recent call last):
  File "bin/cfx", line 33, in <module>
    cuddlefish.run()
  File "/builds/slave/talos-slave/test/addonsdk-poller/addon-sdk-0f7d8b1df10d/python-lib/cuddlefish/__init__.py", line 617, in run
    test_all(env_root, defaults=options.__dict__)
  File "/builds/slave/talos-slave/test/addonsdk-poller/addon-sdk-0f7d8b1df10d/python-lib/cuddlefish/__init__.py", line 397, in test_all
    test_all_packages(env_root, defaults)
  File "/builds/slave/talos-slave/test/addonsdk-poller/addon-sdk-0f7d8b1df10d/python-lib/cuddlefish/__init__.py", line 490, in test_all_packages
    env_root=env_root)
  File "/builds/slave/talos-slave/test/addonsdk-poller/addon-sdk-0f7d8b1df10d/python-lib/cuddlefish/__init__.py", line 763, in run
    loader_modules)
  File "/builds/slave/talos-slave/test/addonsdk-poller/addon-sdk-0f7d8b1df10d/python-lib/cuddlefish/manifest.py", line 657, in build_manifest
    mxt.build(scan_tests, test_filter_re)
  File "/builds/slave/talos-slave/test/addonsdk-poller/addon-sdk-0f7d8b1df10d/python-lib/cuddlefish/manifest.py", line 228, in build
    tme = self.process_module(tmi)
  File "/builds/slave/talos-slave/test/addonsdk-poller/addon-sdk-0f7d8b1df10d/python-lib/cuddlefish/manifest.py", line 410, in process_module
    them_me = self.find_req_for(mi, reqname, looked_in, locations)
  File "/builds/slave/talos-slave/test/addonsdk-poller/addon-sdk-0f7d8b1df10d/python-lib/cuddlefish/manifest.py", line 464, in find_req_for
    raise BAD("too many ..")
cuddlefish.manifest.BadModuleIdentifier: too many .. in require(../system) from ModuleInfo [addon-sdk tests test-path] (/builds/slave/talos-slave/test/addonsdk-poller/addon-sdk-0f7d8b1df10d/test/test-path.js, None)
TinderboxPrint:Jetpack<br/>229/0

program finished with exit code 1


Testing with cfx locally, I see this error, too.

Playing around with the require statement in test-path.js, if I change it from ../system to sdk/system on just that one line, all tests pass for me locally.

I'm going to push https://github.com/mozilla/addon-sdk/pull/1081 to try and see what happens: https://tbpl.mozilla.org/?tree=Try&rev=6c5d77ae3eb2

Since I'll be gone for the next five days and won't be able to see the results of this until I get back, I'll just back out pull request 1080 tonight to get things back to mostly green on the jetpack tree.

If anyone gets to this over the next few days and sees that my new try run is green, you could reland 1080 and 1081 together and see how that works.
Looking at the test results with pull 1081 included, all of the tests that match the filter "path" (100 of them) pass, but most print "undefined". I assume that's what should be printed for these?
(In reply to Wes Kocher (:KWierso) from comment #9)

> Playing around with the require statement in test-path.js, if I change it
> from ../system to sdk/system on just that one line, all tests pass for me
> locally.

I should add that I only changed it in test-path.js, not the identical require() in path.js ...
Assignee: nobody → evold
I don't think this still requires needinfo from me.
Flags: needinfo?(rFobic)
Assignee: evold → nobody
I'm going to wontfix this, as far as I could tell the plan here was to have js build bootstrap extensions from jetpacks, in bug 915376 we are instead going to make the whole building setup redundant.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.