Backed out changeset 37b0fcb54cba (bug 1333403) for eslint failure: browser/components/extensions/ext-c-menus.js:158:24 | 'SingletonEventManager' is not defined. r=backout
authorSebastian Hengst <archaeopteryx@coole-files.de>
Sat, 10 Jun 2017 16:07:23 +0200
changeset 411466 860e84e33e702efd51551430aff30396cc76ac68
parent 411465 30819ae5b63f726476f3a74aed8fb64e26a166a7
child 411467 42f53d05f6f1ed18dbf3b6e3f4d0be532fa3221d
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1333403
milestone55.0a1
backs out37b0fcb54cba5efa068af210908b0a9f33b2eac5
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 37b0fcb54cba (bug 1333403) for eslint failure: browser/components/extensions/ext-c-menus.js:158:24 | 'SingletonEventManager' is not defined. r=backout
toolkit/components/extensions/Schemas.jsm
toolkit/components/extensions/test/xpcshell/test_ext_schemas.js
--- a/toolkit/components/extensions/Schemas.jsm
+++ b/toolkit/components/extensions/Schemas.jsm
@@ -2214,23 +2214,20 @@ const LOADERS = {
   types: "loadType",
 };
 
 class Namespace extends Map {
   constructor(name, path) {
     super();
 
     this._lazySchemas = [];
-    this.initialized = false;
 
     this.name = name;
     this.path = name ? [...path, name] : [...path];
 
-    this.superNamespace = null;
-
     this.permissions = null;
     this.allowedContexts = [];
     this.defaultContexts = [];
   }
 
   /**
    * Adds a JSON Schema object to the set of schemas that represent this
    * namespace.
@@ -2242,35 +2239,27 @@ class Namespace extends Map {
   addSchema(schema) {
     this._lazySchemas.push(schema);
 
     for (let prop of ["permissions", "allowedContexts", "defaultContexts"]) {
       if (schema[prop]) {
         this[prop] = schema[prop];
       }
     }
-
-    if (schema.$import) {
-      this.superNamespace = Schemas.getNamespace(schema.$import);
-    }
   }
 
   /**
    * Initializes the keys of this namespace based on the schema objects
    * added via previous `addSchema` calls.
    */
-  init() {
-    if (this.initialized) {
+  init() { // eslint-disable-line complexity
+    if (!this._lazySchemas) {
       return;
     }
 
-    if (this.superNamespace) {
-      this._lazySchemas.unshift(...this.superNamespace._lazySchemas);
-    }
-
     for (let type of Object.keys(LOADERS)) {
       this[type] = new DefaultMap(() => []);
     }
 
     for (let schema of this._lazySchemas) {
       for (let type of schema.types || []) {
         if (!type.unsupported) {
           this.types.get(type.$extend || type.id).push(type);
@@ -2302,17 +2291,17 @@ class Namespace extends Map {
     // are later used to instantiate an Entry object based on the actual
     // schema object.
     for (let type of Object.keys(LOADERS)) {
       for (let key of this[type].keys()) {
         this.set(key, type);
       }
     }
 
-    this.initialized = true;
+    this._lazySchemas = null;
 
     if (DEBUG) {
       for (let key of this.keys()) {
         this.get(key);
       }
     }
   }
 
--- a/toolkit/components/extensions/test/xpcshell/test_ext_schemas.js
+++ b/toolkit/components/extensions/test/xpcshell/test_ext_schemas.js
@@ -1294,94 +1294,16 @@ add_task(async function testNestedNamesp
   //    "Got the expected property defined in the CustomType instance)
   //
   // ok(instanceOfCustomType.onEvent &&
   //    instanceOfCustomType.onEvent.addListener &&
   //    typeof instanceOfCustomType.onEvent.addListener == "function",
   //    "Got the expected event defined in the CustomType instance");
 });
 
-let $importJson = [
-  {
-    namespace: "from_the",
-    $import: "future",
-  },
-  {
-    namespace: "future",
-    properties: {
-      PROP1: {value: "original value"},
-      PROP2: {value: "second original"},
-    },
-    types: [
-      {
-        id: "Colour",
-        type: "string",
-        enum: ["red", "white", "blue"],
-      },
-    ],
-    functions: [
-      {
-        name: "dye",
-        type: "function",
-        parameters: [
-          {name: "arg", $ref: "Colour"},
-        ],
-      },
-    ],
-  },
-  {
-    namespace: "embrace",
-    $import: "future",
-    properties: {
-      PROP2: {value: "overridden value"},
-    },
-    types: [
-      {
-        id: "Colour",
-        type: "string",
-        enum: ["blue", "orange"],
-      },
-    ],
-  },
-];
-
-add_task(async function test_$import() {
-  let url = "data:," + JSON.stringify($importJson);
-  await Schemas.load(url);
-
-  let root = {};
-  tallied = null;
-  Schemas.inject(root, wrapper);
-  equal(tallied, null);
-
-  equal(root.from_the.PROP1, "original value", "imported property");
-  equal(root.from_the.PROP2, "second original", "second imported property");
-  equal(root.from_the.Colour.RED, "red", "imported enum type");
-  equal(typeof root.from_the.dye, "function", "imported function");
-
-  root.from_the.dye("white");
-  verify("call", "from_the", "dye", ["white"]);
-
-  Assert.throws(() => root.from_the.dye("orange"),
-                /Invalid enumeration value/,
-                "original imported argument type Colour doesn't include 'orange'");
-
-  equal(root.embrace.PROP1, "original value", "imported property");
-  equal(root.embrace.PROP2, "overridden value", "overridden property");
-  equal(root.embrace.Colour.ORANGE, "orange", "overridden enum type");
-  equal(typeof root.embrace.dye, "function", "imported function");
-
-  root.embrace.dye("orange");
-  verify("call", "embrace", "dye", ["orange"]);
-
-  Assert.throws(() => root.embrace.dye("white"),
-                /Invalid enumeration value/,
-                "overridden argument type Colour doesn't include 'white'");
-});
-
 add_task(async function testLocalAPIImplementation() {
   let countGet2 = 0;
   let countProp3 = 0;
   let countProp3SubFoo = 0;
 
   let testingApiObj = {
     get PROP1() {
       // PROP1 is a schema-defined constant.