adobe/brackets — pull request #6719 by busykai (2014-01-31 17:27:14+00:00)
Title: (REVIEW ONLY) Stabilize preferences initialization

Missing documentation, test failures. This is primarily for review.

Instead of chaining the adding of the scopes at the caller, scopes are now added in the order the addScope was called. For each scopeOrder, a shadowScopeOrder is maintained which tracks the scope load status. If the scope was specified explicit "before" location and the "before" scope failed to load, it will be added to the first successfully loaded scope after "before". "default" scope is always loaded for the context and it's always resolved.

Deficient $.when is replaced with new Async.waitForAll (which would call always only when all promises are either resolved or rejected).

cc: @dangoor -- this is working, but not mergeable fix for #6660. I'll create task list to complete it later today or tomorrow. Please let me know what you think.