Bug 1321214 - Remove legacy generator from addon-sdk/. r=mossop
authorTooru Fujisawa <arai_a@mac.com>
Thu, 01 Dec 2016 18:04:50 +0900
changeset 324980 ad9064b5fe9a0da54cc820482a61759a730a1c0b
parent 324979 46f6ea9600f0aa6dbf7433f4e2295b3bad241e45
child 324981 7dc7e58f62f4f837410f92527e70c2eaa543b50b
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersmossop
bugs1321214
milestone53.0a1
Bug 1321214 - Remove legacy generator from addon-sdk/. r=mossop
addon-sdk/source/lib/sdk/content/page-mod.js
addon-sdk/source/lib/sdk/page-mod.js
addon-sdk/source/test/test-addon-bootstrap.js
addon-sdk/source/test/test-context-menu@2.js
addon-sdk/source/test/test-event-core.js
addon-sdk/source/test/test-event-dom.js
--- a/addon-sdk/source/lib/sdk/content/page-mod.js
+++ b/addon-sdk/source/lib/sdk/content/page-mod.js
@@ -47,17 +47,17 @@ const ChildPageMod = Class({
   ],
   setup: function PageMod(model) {
     merge(this, model);
 
     // Set listeners on {PageMod} itself, not the underlying worker,
     // like `onMessage`, as it'll get piped.
     setListeners(this, model);
 
-    function deserializeRules(rules) {
+    function* deserializeRules(rules) {
       for (let rule of rules) {
         yield rule.type == "string" ? rule.value
                                     : new RegExp(rule.pattern, rule.flags);
       }
     }
 
     let include = [...deserializeRules(this.include)];
     this.include = Rules();
--- a/addon-sdk/source/lib/sdk/page-mod.js
+++ b/addon-sdk/source/lib/sdk/page-mod.js
@@ -113,17 +113,17 @@ const PageMod = Class({
 
     // Set listeners on {PageMod} itself, not the underlying worker,
     // like `onMessage`, as it'll get piped.
     setListeners(this, options);
 
     pagemods.set(model.id, this);
     workers.set(this, []);
 
-    function serializeRules(rules) {
+    function* serializeRules(rules) {
       for (let rule of rules) {
         yield isRegExp(rule) ? { type: "regexp", pattern: rule.source, flags: rule.flags }
                              : { type: "string", value: rule };
       }
     }
 
     model.childOptions = omit(model, ["include", "exclude", "contentScriptOptions"]);
     model.childOptions.include = [...serializeRules(model.include)];
--- a/addon-sdk/source/test/test-addon-bootstrap.js
+++ b/addon-sdk/source/test/test-addon-bootstrap.js
@@ -16,17 +16,17 @@ const BOOTSTRAP_REASONS = {
   ADDON_ENABLE    : 3,
   ADDON_DISABLE   : 4,
   ADDON_INSTALL   : 5,
   ADDON_UNINSTALL : 6,
   ADDON_UPGRADE   : 7,
   ADDON_DOWNGRADE : 8
 };
 
-exports["test install/startup/shutdown/uninstall all return a promise"] = function(assert) {
+exports["test install/startup/shutdown/uninstall all return a promise"] = function*(assert) {
   let uri = require.resolve("./fixtures/addon/bootstrap.js");
   let id = "test-min-boot@jetpack";
   let bootstrapScope = create({
     id: id,
     uri: uri
   });
 
   // As we don't want our caller to control the JS version used for the
--- a/addon-sdk/source/test/test-context-menu@2.js
+++ b/addon-sdk/source/test/test-context-menu@2.js
@@ -411,17 +411,17 @@ exports["test iframe context"] = withTab
     iframe: new Item({
       label: "iframe",
       context: [new Contexts.Frame()]
     }),
     h2: new Item({
       label: "element",
       context: [new Contexts.Selector("*")]
     })
-  }, function(_) {
+  }, function*(_) {
     assert.deepEqual((yield captureContextMenu("iframe")),
                      menugroup(menuseparator(),
                                menuitem({label: "page"}),
                                menuitem({label: "iframe"}),
                                menuitem({label: "element"})),
                      "matching items are present");
 
     assert.deepEqual((yield captureContextMenu("h1")),
--- a/addon-sdk/source/test/test-event-core.js
+++ b/addon-sdk/source/test/test-event-core.js
@@ -258,17 +258,17 @@ exports['test listen to all events'] = f
   assert.deepEqual(actual[1], ['foo', 'hello'],
     'wildcard listener called');
 
   emit(target, 'bar', 'goodbye');
   assert.deepEqual(actual[2], ['bar', 'goodbye'],
     'wildcard listener called for unbound event name');
 };
 
-exports['test once'] = function(assert, done) {
+exports['test once'] = function*(assert, done) {
   let target = {};
   let called = false;
   let { resolve, promise } = defer();
 
   once(target, 'foo', function(value) {
     assert.ok(!called, "listener called only once");
     assert.equal(value, "bar", "correct argument was passed");
   });
--- a/addon-sdk/source/test/test-event-dom.js
+++ b/addon-sdk/source/test/test-event-dom.js
@@ -10,17 +10,17 @@ const { Cc, Ci } = require('chrome');
 const els = Cc["@mozilla.org/eventlistenerservice;1"].
             getService(Ci.nsIEventListenerService);
 
 function countListeners(target, type) {
   let listeners = els.getListenerInfoFor(target, {});
   return listeners.filter(listener => listener.type == type).length;
 }
 
-exports['test window close clears listeners'] = function(assert) {
+exports['test window close clears listeners'] = function*(assert) {
   let window = yield openWindow();
   let loader = Loader(module);
 
   // Any element will do here
   let gBrowser = window.gBrowser;
 
   // Other parts of the app may be listening for this
   let windowListeners = countListeners(window, "DOMWindowClose");