Backed out changeset 15ab89563679 (bug 1319567) for browser-chrome failures a=backout
authorWes Kocher <wkocher@mozilla.com>
Tue, 22 Nov 2016 16:57:39 -0800
changeset 323955 e52d162e55a32d6f9a905ab1eb4831f0bb98593f
parent 323954 3e36c1367ba2453e8325fbd1f9487255f345bd1f
child 323956 30297a41cdd1177f3ace2447642d82619af73aa5
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersbackout
bugs1319567
milestone53.0a1
backs out15ab89563679a75ad391c5124e269dbafd798956
Backed out changeset 15ab89563679 (bug 1319567) for browser-chrome failures a=backout
browser/components/extensions/ext-utils.js
--- a/browser/components/extensions/ext-utils.js
+++ b/browser/components/extensions/ext-utils.js
@@ -919,16 +919,19 @@ TabManager.for = function(extension) {
 /* eslint-disable mozilla/balanced-listeners */
 extensions.on("shutdown", (type, extension) => {
   tabManagers.delete(extension);
 });
 /* eslint-enable mozilla/balanced-listeners */
 
 // Manages mapping between XUL windows and extension window IDs.
 global.WindowManager = {
+  _windows: new WeakMap(),
+  _nextId: 0,
+
   // Note: These must match the values in windows.json.
   WINDOW_ID_NONE: -1,
   WINDOW_ID_CURRENT: -2,
 
   get topWindow() {
     return Services.wm.getMostRecentWindow("navigator:browser");
   },
 
@@ -957,18 +960,22 @@ global.WindowManager = {
     if (options.width !== null || options.height !== null) {
       let width = options.width !== null ? options.width : window.outerWidth;
       let height = options.height !== null ? options.height : window.outerHeight;
       window.resizeTo(width, height);
     }
   },
 
   getId(window) {
-    return window.QueryInterface(Ci.nsIInterfaceRequestor)
-                 .getInterface(Ci.nsIDOMWindowUtils).outerWindowID;
+    if (this._windows.has(window)) {
+      return this._windows.get(window);
+    }
+    let id = this._nextId++;
+    this._windows.set(window, id);
+    return id;
   },
 
   getWindow(id, context) {
     if (id == this.WINDOW_ID_CURRENT) {
       return currentWindow(context);
     }
 
     for (let window of WindowListManager.browserWindows(true)) {