Closed Bug 971442 Opened 11 years ago Closed 9 years ago

[System2] Instantiable System

Categories

(Firefox OS Graveyard :: Gaia::System, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1094759

People

(Reporter: alive, Unassigned)

References

Details

We need system.js to be instantiable and let bootstrap to instantiate it.
Also jsdoc + unit test wanted.
No longer depends on: 924313, 938954, 959036
No longer depends on: system-app-v2
This one seems pretty simple, I'll take it.
Assignee: nobody → kgrandon
Status: NEW → ASSIGNED
Whiteboard: [c= p=2 s= u=]
Keywords: perf
Signing up as the backup assignee of this bug :)
Sure thing Tim :) I have a million things to do - so if you're interested it's all yours. Otherwise feel free to send it back to me.
Assignee: kgrandon → timdream
Keywords: perf
Whiteboard: [c= p=2 s= u=]
This bug is not as easy to solve as it seems.

First of all, I don't know if I should <script defer> system.js and/or bootstrap.js. If we defer them, nothing (e.g. event listeners) will be run before the DOM is ready, therefore we might lose some time to show something fast like the init logo.

I have also investigated more and it seems bug 793082 is still valid in terms making sure mozChromeEvent timing issue.

However, bug 924032 moved launch request away from mozChromeEvent, so I would worry we would miss that. Given the fact it will probably not a bug fixable here, I will ignore that.
The other problem around NOT using <script defer> for bootstrip.js is that DOMContentLoaded is currently affected by bug 688580, so there is no way for non-defered script to get a consistent callback at the moment right after all other deferred scripts.
I was looking at this a bit earlier, and we probably do need a *single* non-deferred object. My thoughts were that we could combine system.js and bootstrap.js into a single app containing class. Things that don't need to be there onload could be moved into other files, or within a bootstrap method. E.g., in a new app.js:

function App() {
  ... // Add any necessary listeners
  window.addEventListener('load', this.bootstrap.bind(this));
  window.addEventListener('mozChromeEvent', this);
}

App.prototype = {
  bootstrap: function() {
    this.activities = new Activities();
    this.devtoolsView = new DevtoolsView();
    this.ttlView = new TTLView();
    // Other new and exciting classes.
  }
};

// Inside same file (or app_init.js for easy unit testing)
window.app = new App();


Anyway, I'm not sure if it solves your problem - but just throwing my thoughts in here.
Anything needs to be done here is probably all covered in bug 1094759.
Assignee: timdream → nobody
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.