Bug 1027246 - replaced function with function* for generators. r=fitzgen
☠☠ backed out by 6ad00b017a2b ☠ ☠
authorVikneshwar <lviknesh@gmail.com>
Sun, 08 Feb 2015 00:48:43 +0000
changeset 242056 46cfe0a6aa6c8611569b5f5f9aa52f80abe20923
parent 242055 9ef166659e177f8648dc34490716dbfaad1c294f
child 242057 f4240674fd6c18bdd59c759bd658c6ec3ab2012a
push id634
push usermozilla@noorenberghe.ca
push dateTue, 10 Feb 2015 22:34:30 +0000
reviewersfitzgen
bugs1027246
milestone38.0a1
Bug 1027246 - replaced function with function* for generators. r=fitzgen
browser/devtools/projecteditor/lib/stores/local.js
browser/devtools/shadereditor/shadereditor.js
toolkit/devtools/server/actors/stylesheets.js
--- a/browser/devtools/projecteditor/lib/stores/local.js
+++ b/browser/devtools/projecteditor/lib/stores/local.js
@@ -103,17 +103,17 @@ var LocalStore = Class({
     if (this.resources.has(path)) {
       return promise.resolve(this.resources.get(path));
     }
 
     if (!this.contains(path)) {
       return promise.reject(new Error(path + " does not belong to " + this.path));
     }
 
-    return Task.spawn(function() {
+    return Task.spawn(function*() {
       let parent = yield this.resourceFor(OS.Path.dirname(path));
 
       let info;
       try {
         info = yield OS.File.stat(path);
       } catch (ex if ex instanceof OS.File.Error && ex.becauseNoSuchFile) {
         if (!options.create) {
           throw ex;
--- a/browser/devtools/shadereditor/shadereditor.js
+++ b/browser/devtools/shadereditor/shadereditor.js
@@ -118,17 +118,17 @@ let EventsHandler = {
   },
 
   /**
    * Called for each location change in the debugged tab.
    */
   _onTabNavigated: function(event, {isFrameSwitching}) {
     switch (event) {
       case "will-navigate": {
-        Task.spawn(function() {
+        Task.spawn(function*() {
           // Make sure the backend is prepared to handle WebGL contexts.
           if (!isFrameSwitching) {
             gFront.setup({ reload: false });
           }
 
           // Reset UI.
           ShadersListView.empty();
           // When switching to an iframe, ensure displaying the reload button.
@@ -389,17 +389,17 @@ let ShadersEditorsView = {
    */
   setText: function(sources) {
     let view = this;
     function setTextAndClearHistory(editor, text) {
       editor.setText(text);
       editor.clearHistory();
     }
 
-    return Task.spawn(function() {
+    return Task.spawn(function*() {
       yield view._toggleListeners("off");
       yield promise.all([
         view._getEditor("vs").then(e => setTextAndClearHistory(e, sources.vs)),
         view._getEditor("fs").then(e => setTextAndClearHistory(e, sources.fs))
       ]);
       yield view._toggleListeners("on");
     }).then(() => window.emit(EVENTS.SOURCES_SHOWN, sources));
   },
@@ -485,17 +485,17 @@ let ShadersEditorsView = {
   /**
    * Recompiles the source code for the shader being edited.
    * This function is fired at a certain delay after the user stops typing.
    *
    * @param string type
    *        The corresponding shader type for the focused editor (e.g. "vs").
    */
   _doCompile: function(type) {
-    Task.spawn(function() {
+    Task.spawn(function*() {
       let editor = yield this._getEditor(type);
       let shaderActor = yield ShadersListView.selectedAttachment[type];
 
       try {
         yield shaderActor.compile(editor.getText());
         this._onSuccessfulCompilation();
       } catch (e) {
         this._onFailedCompilation(type, editor, e);
--- a/toolkit/devtools/server/actors/stylesheets.js
+++ b/toolkit/devtools/server/actors/stylesheets.js
@@ -94,17 +94,17 @@ let StyleSheetsActor = exports.StyleShee
   /**
    * Add all the stylesheets in this document and its subframes.
    * Assumes the document is loaded.
    *
    * @return {Promise}
    *         Promise that resolves with an array of StyleSheetActors
    */
   _addAllStyleSheets: function() {
-    return Task.spawn(function() {
+    return Task.spawn(function*() {
       let documents = [this.document];
       let actors = [];
 
       for (let doc of documents) {
         let sheets = yield this._addStyleSheets(doc.styleSheets);
         actors = actors.concat(sheets);
 
         // Recursively handle style sheets of the documents in iframes.
@@ -127,17 +127,17 @@ let StyleSheetsActor = exports.StyleShee
    * @param {[DOMStyleSheet]} styleSheets
    *        Stylesheets to add
    *
    * @return {Promise}
    *         Promise that resolves to an array of StyleSheetActors
    */
   _addStyleSheets: function(styleSheets)
   {
-    return Task.spawn(function() {
+    return Task.spawn(function*() {
       let actors = [];
       for (let i = 0; i < styleSheets.length; i++) {
         let actor = this.parentActor.createStyleSheetActor(styleSheets[i]);
         actors.push(actor);
 
         // Get all sheets, including imported ones
         let imports = yield this._getImported(actor);
         actors = actors.concat(imports);
@@ -150,17 +150,17 @@ let StyleSheetsActor = exports.StyleShee
    * Get all the stylesheets @imported from a stylesheet.
    *
    * @param  {DOMStyleSheet} styleSheet
    *         Style sheet to search
    * @return {Promise}
    *         A promise that resolves with an array of StyleSheetActors
    */
   _getImported: function(styleSheet) {
-    return Task.spawn(function() {
+    return Task.spawn(function*() {
       let rules = yield styleSheet.getCSSRules();
       let imported = [];
 
       for (let i = 0; i < rules.length; i++) {
         let rule = rules[i];
         if (rule.type == Ci.nsIDOMCSSRule.IMPORT_RULE) {
           // Associated styleSheet may be null if it has already been seen due
           // to duplicate @imports for the same URL.