Reformat
Merge remote-tracking branch 'upstream/master' into small-fixes-3
Merge pull request #3333 from ussuri/small-fixes-3

Reformat
Fix up the import path after #3332.
Merge pull request #3342 from rpaquay/fix-unittest-after-big-rename

Fix up the import path after #3332.
Fix Ace-registered file extension for pre-CSP HTMLs
Merge pull request #3343 from ussuri/small-fixes-3

Fix Ace-registered file extension for pre-CSP HTMLs
remove extra symlinks from web/ and build/web/
review comments
move the dart-sdk.bz binary from web/ to lib/
Merge pull request #3346 from devoncarew/devoncarew_move_sdk

move the dart-sdk.bz binary from web/ to lib/
Merge pull request #3344 from devoncarew/devoncarew_remove_symlinks

remove extra symlinks from web/ and build/web/
Update cde to use Polymer 0.13.0.

Upgrade to polymer 0.13.0+3.

There was an issue where CDE would not starting up properly (infinite spinning wheel) when upgrading from polymer 0.12. The root cause was that we were not registering the "spark-icon" element even though we use it (transitively from spark-button) in the main CDE page.

The chain of events that lead to this problem was as follows:

* The Polymer.onReady future was never "completed", so cde would not finish initialization and switch to the main UI. He is the cde code:

    return polymer.Polymer.onReady.then((_) {
      spark.uiReady();
      return spark.init();
    });

* It seems (not 100% sure) out that "onReady" is called when the "polymer-ready" event is fired.

  whenPolymerReady(function() {
    document.body.removeAttribute('unresolved');
    document.dispatchEvent(
      new CustomEvent('polymer-ready', {bubbles: true})
    );
  });

* The definition of "whenPolymerReady" is as follows:

  function whenPolymerReady(callback) {
    queue.waitToReady = true;
    CustomElements.ready = false;
    HTMLImports.whenImportsReady(function() {
      queue.addReadyCallback(callback);
      queue.waitToReady = false;
      queue.check();
    });
  }

This means that "callback" (the function that fires the "polymer-ready" event) is called when the "queue" object is ready.

* The "queue.check()" function does the following:

    check: function() {
	  (...)
      if (this.canReady()) {
        this.ready();
        return true;
      }
    },

* the "canReady()" function was never returning "true", hence the event was never fired.

    canReady: function() {
      return !this.waitToReady && this.isEmpty();
    },

 * the "isEmpty" function was never returning true because the "elements" array contained at least one element with a "queue.flushable" to false.

    isEmpty: function() {
      for (var i=0, l=elements.length, e; (i<l) &&
          (e=elements[i]); i++) {
        if (e.__queue && !e.__queue.flushable) {
          return;
        }
      }
      return true;
    },

*  After some investigation, it turns out that element was the "spark-icon" element, which is used in the Spark main ui page, but never registered. To be "flushable", the "go" method must be called.

    // tell the queue an element is ready to be registered
    go: function(element) {
      var readied = this.remove(element);
      if (readied) {
        element.__queue.flushable = true;
        this.addToFlushQueue(readied);
        this.check();
      }
    },

How we figured this out:

* It turns out that it is possible to add manual logging in Dart packages, because they reside as source on disk.
 * For dart code, adding a "print" statement will log in both the Dartium console, and in the Dart editor output window.
 * For JavaScript code (poylmer in this case), using "console.log" will also log to both outout.

* The first thing we did was change packages/polymer/src/js/polymer/polymer.html to load "polymer.concat.js" instead of "polymer.js", because polymer.js is minified and close to impossible to modify manually.

Note: Every change to the source code of a Dart packages (e.g. polymer), wheter it is Dart or JavaScript cdeo requires to run "grind setup" for the change to take effect on Spark if running in Dartium from the Dart Editor.

* Once this is done, locating the bug was a matter of adding log statements in the Dart and JavaScript code to figure out why the "polymer-ready" event was never fired.
Merge pull request #3348 from rpaquay/upgrade-to-polymer-0.13

Update cde to use Polymer 0.13.0.
Merge remote-tracking branch 'upstream/master' into polymer-0.13.0

Conflicts:
	ide/pubspec.yaml
	ide/web/spark_bootstrap.dart
	widgets/pubspec.yaml