Bug 580618: don't use weak references to hold on to hud objects, feedback=ddahl, r=gavin, a=blocking
authorMihai Sucan <mihai.sucan@gmail.com>
Wed, 17 Nov 2010 14:21:14 -0500
changeset 57653 0281473dbd79e0e01e52f130e96b790a0b60d416
parent 57652 2bd86fdd9c622611e1691e6bc3cb012a0dc39e5a
child 57654 f31dab55e41a57bed39fe809a764935b830bacf9
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersgavin, blocking
bugs580618
milestone2.0b8pre
Bug 580618: don't use weak references to hold on to hud objects, feedback=ddahl, r=gavin, a=blocking
toolkit/components/console/hudservice/HUDService.jsm
toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_580030_errors_after_page_reload.js
toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_580400_groups.js
toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_582201_duplicate_errors.js
toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_583816_tab_focus.js
toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_586388_select_all.js
toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_587617_output_copy.js
toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_589162_css_filter.js
toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_592442_closing_brackets.js
toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_594477_clickable_output.js
toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_594497_history_arrow_keys.js
toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_595350_multiple_windows_and_tabs.js
toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_595934_message_categories.js
toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_601352_scroll.js
toolkit/components/console/hudservice/tests/browser/browser_webconsole_chrome.js
toolkit/components/console/hudservice/tests/browser/browser_webconsole_completion.js
toolkit/components/console/hudservice/tests/browser/browser_webconsole_consoleonpage.js
toolkit/components/console/hudservice/tests/browser/browser_webconsole_execution_scope.js
toolkit/components/console/hudservice/tests/browser/browser_webconsole_history.js
toolkit/components/console/hudservice/tests/browser/browser_webconsole_hud_getters.js
toolkit/components/console/hudservice/tests/browser/browser_webconsole_js_input_and_output_styling.js
toolkit/components/console/hudservice/tests/browser/browser_webconsole_js_input_expansion.js
toolkit/components/console/hudservice/tests/browser/browser_webconsole_jsterm.js
toolkit/components/console/hudservice/tests/browser/browser_webconsole_null_and_undefined_output.js
toolkit/components/console/hudservice/tests/browser/browser_webconsole_output_order.js
toolkit/components/console/hudservice/tests/browser/browser_webconsole_property_panel.js
toolkit/components/console/hudservice/tests/browser/browser_webconsole_property_provider.js
--- a/toolkit/components/console/hudservice/HUDService.jsm
+++ b/toolkit/components/console/hudservice/HUDService.jsm
@@ -1801,43 +1801,38 @@ HUD_SERVICE.prototype =
     }
     if (msgType !== null && !this.getFilterState(aHUDId, msgType)) {
       // The node is filtered by type.
       aNewNode.classList.add("hud-filtered-by-type");
     }
   },
 
   /**
-   * Keeps a weak reference for each HeadsUpDisplay that is created
-   *
+   * Keeps a reference for each HeadsUpDisplay that is created
    */
-  hudWeakReferences: {},
+  hudReferences: {},
 
   /**
-   * Register a weak reference of each HeadsUpDisplay that is created
-   *
-   * @param object aHUDRef
-   * @param string aHUDId
-   * @returns void
+   * Register a reference of each HeadsUpDisplay that is created
    */
-  registerHUDWeakReference:
-  function HS_registerHUDWeakReference(aHUDRef, aHUDId)
+  registerHUDReference:
+  function HS_registerHUDReference(aHUD)
   {
-    this.hudWeakReferences[aHUDId] = aHUDRef;
+    this.hudReferences[aHUD.hudId] = aHUD;
   },
 
   /**
    * Deletes a HeadsUpDisplay object from memory
    *
    * @param string aHUDId
    * @returns void
    */
   deleteHeadsUpDisplay: function HS_deleteHeadsUpDisplay(aHUDId)
   {
-    delete this.hudWeakReferences[aHUDId].get();
+    delete this.hudReferences[aHUDId];
   },
 
   /**
    * Register a new Heads Up Display
    *
    * @param nsIDOMWindow aContentWindow
    * @returns void
    */
@@ -2621,17 +2616,17 @@ HUD_SERVICE.prototype =
     message.level = logLevel;
 
     message.message = msgLogLevel + " " +
                       aActivityObject.errorMessage + " " +
                       errFile + " " +
                       lineCol + " " +
                       msgCategory + " " + aActivityObject.category;
 
-    let outputNode = this.hudWeakReferences[aHUDId].get().outputNode;
+    let outputNode = this.hudReferences[aHUDId].outputNode;
 
     var messageObject =
     this.messageFactory(message, message.level, outputNode, aActivityObject);
 
     this.logMessage(messageObject.messageObject, outputNode, messageObject.messageNode);
   },
 
   /**
@@ -2904,21 +2899,20 @@ HUD_SERVICE.prototype =
     if (!hudNode) {
       // get nBox object and call new HUD
       let config = { parentNode: nBox,
                      contentWindow: aContentWindow
                    };
 
       hud = new HeadsUpDisplay(config);
 
-      let hudWeakRef = Cu.getWeakReference(hud);
-      HUDService.registerHUDWeakReference(hudWeakRef, hudId);
+      HUDService.registerHUDReference(hud);
     }
     else {
-      hud = this.hudWeakReferences[hudId].get();
+      hud = this.hudReferences[hudId];
       if (aContentWindow == aContentWindow.top) {
         // TODO: name change?? doesn't actually re-attach the console
         hud.reattachConsole(aContentWindow);
       }
     }
 
     // need to detect that the console component has been paved over
     // TODO: change how we detect our console: bug 612405
@@ -3528,17 +3522,17 @@ let ConsoleAPIObserver = {
 
       let hudId;
       let displays = HUDService._headsUpDisplays;
       let foundConsoleId = false;
       for (let idx in displays) {
         if (parseInt(displays[idx].windowId) == parseInt(windowId)) {
           hudId = displays[idx].id;
           foundConsoleId = true;
-          let webConsole = HUDService.hudWeakReferences[hudId].get();
+          let webConsole = HUDService.hudReferences[hudId];
 
           this.sendToWebConsole(webConsole, aMessage.level, aMessage.arguments);
         }
       }
     }
     else if (aTopic == "quit-application-granted") {
       this.shutdown();
     }
--- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_580030_errors_after_page_reload.js
+++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_580030_errors_after_page_reload.js
@@ -91,17 +91,17 @@ var consoleObserver = {
     }
 
     Services.console.unregisterListener(this);
 
     const successMsg = "Found the error message after page reload";
     const errMsg = "Could not get the error message after page reload";
 
     hudId = HUDService.displaysIndex()[0];
-    hud = HUDService.hudWeakReferences[hudId].get();
+    hud = HUDService.hudReferences[hudId];
     outputNode = hud.outputNode;
 
     executeSoon(function() {
       testLogEntry(outputNode, "fooBazBaz",
                    { success: successMsg, err: errMsg });
       finishTest();
     });
   }
--- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_580400_groups.js
+++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_580400_groups.js
@@ -49,17 +49,17 @@ function test() {
 
 function testGroups() {
   browser.removeEventListener("DOMContentLoaded", testGroups, false);
 
   openConsole();
 
   let hudId = HUDService.displaysIndex()[0];
 
-  let HUD = HUDService.hudWeakReferences[hudId].get();
+  let HUD = HUDService.hudReferences[hudId];
   let jsterm = HUD.jsterm;
   let outputNode = jsterm.outputNode;
 
   let timestamp0 = Date.now();
   jsterm.execute("0");
   is(outputNode.querySelectorAll(".hud-group").length, 1,
     "one group exists after the first console message");
 
--- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_582201_duplicate_errors.js
+++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_582201_duplicate_errors.js
@@ -70,17 +70,17 @@ var consoleObserver = {
     if (!(aMessage instanceof Ci.nsIScriptError) ||
       aMessage.category != "content javascript") {
       return;
     }
 
     Services.console.unregisterListener(this);
 
     hudId = HUDService.displaysIndex()[0];
-    hud = HUDService.hudWeakReferences[hudId].get();
+    hud = HUDService.hudReferences[hudId];
     outputNode = hud.outputNode;
 
     executeSoon(function () {
       var text = outputNode.textContent;
       var error1pos = text.indexOf("fooDuplicateError1");
       ok(error1pos > -1, "found fooDuplicateError1");
       if (error1pos > -1) {
         ok(text.indexOf("fooDuplicateError1", error1pos + 1) == -1,
--- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_583816_tab_focus.js
+++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_583816_tab_focus.js
@@ -14,17 +14,17 @@ let inputNode;
 
 function tabLoad(aEvent) {
   browser.removeEventListener(aEvent.type, arguments.callee, true);
 
   waitForFocus(function() {
     openConsole();
 
     let hudId = HUDService.getHudIdByWindow(content);
-    HUD = HUDService.hudWeakReferences[hudId].get();
+    HUD = HUDService.hudReferences[hudId];
 
     let display = HUDService.getOutputNodeById(hudId);
     inputNode = display.querySelector(".jsterm-input-node");
 
     inputNode.focus();
     executeSoon(function() {
       is(inputNode.getAttribute("focused"), "true", "inputNode is focused");
       HUD.jsterm.setInputValue("doc");
--- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_586388_select_all.js
+++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_586388_select_all.js
@@ -17,17 +17,17 @@ function test() {
 }
 
 function testSelectionWhenMovingBetweenBoxes() {
   browser.removeEventListener("DOMContentLoaded",
                               testSelectionWhenMovingBetweenBoxes, false);
   openConsole();
 
   let hudId = HUDService.displaysIndex()[0];
-  let jsterm = HUDService.hudWeakReferences[hudId].get().jsterm;
+  let jsterm = HUDService.hudReferences[hudId].jsterm;
 
   // Fill the console with some output.
   jsterm.clearOutput();
   jsterm.execute("1 + 2");
   jsterm.execute("3 + 4");
   jsterm.execute("5 + 6");
 
   outputNode = jsterm.outputNode;
--- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_587617_output_copy.js
+++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_587617_output_copy.js
@@ -17,17 +17,17 @@ function test() {
 
 function tabLoaded() {
   browser.removeEventListener("load", tabLoaded, true);
   openConsole();
 
   // See bugs 574036, 586386 and 587617.
 
   hudId = HUDService.displaysIndex()[0];
-  let HUD = HUDService.hudWeakReferences[hudId].get().HUDBox;
+  let HUD = HUDService.hudReferences[hudId].HUDBox;
   let filterBox = HUD.querySelector(".hud-filter-box");
   outputNode = HUD.querySelector(".hud-output-node");
   let selection = getSelection();
   let jstermInput = HUD.querySelector(".jsterm-input-node");
   let console = browser.contentWindow.wrappedJSObject.console;
   let contentSelection = browser.contentWindow.wrappedJSObject.getSelection();
 
   let make_selection = function () {
--- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_589162_css_filter.js
+++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_589162_css_filter.js
@@ -12,17 +12,17 @@
 const TEST_URI = "data:text/html,<div style='font-size:3em;" +
   "foobarCssParser:baz'>test CSS parser filter</div>";
 
 function onContentLoaded()
 {
   browser.removeEventListener("load", arguments.callee, true);
 
   hudId = HUDService.displaysIndex()[0];
-  HUD = HUDService.hudWeakReferences[hudId].get().HUDBox;
+  HUD = HUDService.hudReferences[hudId].HUDBox;
   let filterBox = HUD.querySelector(".hud-filter-box");
   let outputNode = HUD.querySelector(".hud-output-node");
 
   let warningFound = "the unknown CSS property warning is displayed";
   let warningNotFound = "could not find the unknown CSS property warning";
 
   testLogEntry(outputNode, "foobarCssParser",
                { success: warningFound, err: warningNotFound }, true);
--- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_592442_closing_brackets.js
+++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_592442_closing_brackets.js
@@ -18,17 +18,17 @@ function test() {
   browser.addEventListener("load", testExtraneousClosingBrackets, true);
 }
 
 function testExtraneousClosingBrackets(aEvent) {
   browser.removeEventListener(aEvent.type, arguments.callee, true);
 
   openConsole();
   let hudId = HUDService.displaysIndex()[0];
-  let jsterm = HUDService.hudWeakReferences[hudId].get().jsterm;
+  let jsterm = HUDService.hudReferences[hudId].jsterm;
 
   jsterm.setInputValue("document.getElementById)");
 
   let error = false;
   try {
     jsterm.complete(jsterm.COMPLETE_HINT_ONLY);
   }
   catch (ex) {
--- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_594477_clickable_output.js
+++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_594477_clickable_output.js
@@ -14,17 +14,17 @@ let HUD;
 let outputItem;
 
 function tabLoad1(aEvent) {
   browser.removeEventListener(aEvent.type, arguments.callee, true);
 
   openConsole();
 
   let hudId = HUDService.getHudIdByWindow(browser.contentWindow);
-  HUD = HUDService.hudWeakReferences[hudId].get();
+  HUD = HUDService.hudReferences[hudId];
 
   let display = HUDService.getOutputNodeById(hudId);
   outputNode = display.querySelector(".hud-output-node");
 
   browser.addEventListener("load", tabLoad2, true);
 
   // Reload so we get some output in the console.
   browser.contentWindow.location.reload();
--- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_594497_history_arrow_keys.js
+++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_594497_history_arrow_keys.js
@@ -14,17 +14,17 @@ let inputNode, testKey, values, pos;
 
 function tabLoad(aEvent) {
   browser.removeEventListener(aEvent.type, arguments.callee, true);
 
   waitForFocus(function() {
     openConsole();
 
     let hudId = HUDService.getHudIdByWindow(content);
-    HUD = HUDService.hudWeakReferences[hudId].get();
+    HUD = HUDService.hudReferences[hudId];
 
     let display = HUDService.getOutputNodeById(hudId);
     inputNode = display.querySelector(".jsterm-input-node");
 
     inputNode.focus();
 
     ok(!inputNode.value, "inputNode.value is empty");
 
--- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_595350_multiple_windows_and_tabs.js
+++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_595350_multiple_windows_and_tabs.js
@@ -53,17 +53,17 @@ function addTabs(aWindow) {
 
 function performTest() {
   // open the Web Console for each of the four tabs and log a message.
   for (let i = 0; i < openTabs.length; i++) {
     let tab = openTabs[i];
     HUDService.activateHUDForContext(tab);
     let hudId = HUDService.getHudIdByWindow(tab.linkedBrowser.contentWindow);
     ok(hudId, "HUD is open for tab " + i);
-    let HUD = HUDService.hudWeakReferences[hudId].get();
+    let HUD = HUDService.hudReferences[hudId];
     HUD.console.log("message for tab " + i);
   }
 
   let displays = HUDService.displaysIndex();
   is(displays.length, 4, "four displays found");
 
   win2.close();
 
--- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_595934_message_categories.js
+++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_595934_message_categories.js
@@ -75,17 +75,17 @@ let TestObserver = {
 };
 
 function tabLoad(aEvent) {
   browser.removeEventListener(aEvent.type, arguments.callee, true);
 
   openConsole();
 
   let hudId = HUDService.getHudIdByWindow(content);
-  hud = HUDService.hudWeakReferences[hudId].get();
+  hud = HUDService.hudReferences[hudId];
 
   Services.console.registerListener(TestObserver);
 
   executeSoon(testNext);
 }
 
 function testNext() {
   hud.jsterm.clearOutput();
--- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_601352_scroll.js
+++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_601352_scroll.js
@@ -9,17 +9,17 @@
  * ***** END LICENSE BLOCK ***** */
 
 function tabLoad(aEvent) {
   browser.removeEventListener(aEvent.type, arguments.callee, true);
 
   openConsole();
 
   let hudId = HUDService.getHudIdByWindow(content);
-  let HUD = HUDService.hudWeakReferences[hudId].get();
+  let HUD = HUDService.hudReferences[hudId];
 
   let longMessage = "";
   for (let i = 0; i < 50; i++) {
     longMessage += "LongNonwrappingMessage";
   }
 
   for (let i = 0; i < 50; i++) {
     HUD.console.log("test message " + i);
--- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_chrome.js
+++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_chrome.js
@@ -47,17 +47,17 @@ function test() {
 }
 
 function testChrome() {
   browser.removeEventListener("DOMContentLoaded", testChrome, false);
 
   openConsole();
 
   hudId = HUDService.displaysIndex()[0];
-  hud = HUDService.hudWeakReferences[hudId].get();
+  hud = HUDService.hudReferences[hudId];
   ok(hud, "we have a console");
   
   hudBox = HUDService.getHeadsUpDisplay(hudId);
   ok(hudBox, "we have the console display");
   
   let jsterm = hud.jsterm;
   ok(jsterm, "we have a jsterm");
 
--- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_completion.js
+++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_completion.js
@@ -49,17 +49,17 @@ function test() {
 
 function testCompletion() {
   browser.removeEventListener("DOMContentLoaded", testCompletion, false);
 
   openConsole();
 
   hudId = HUDService.displaysIndex()[0];
 
-  var HUD = HUDService.hudWeakReferences[hudId].get();
+  var HUD = HUDService.hudReferences[hudId];
   var jsterm = HUD.jsterm;
   var input = jsterm.inputNode;
 
   // Test typing 'docu'.
   input.value = "docu";
   input.setSelectionRange(4, 4);
   jsterm.complete(jsterm.COMPLETE_HINT_ONLY);
   is(input.value, "document", "'docu' completion");
--- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_consoleonpage.js
+++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_consoleonpage.js
@@ -21,17 +21,17 @@ function test()
 }
 
 function testOpenWebConsole()
 {
   openConsole();
   is(HUDService.displaysIndex().length, 1, "WebConsole was opened");
 
   hudId = HUDService.displaysIndex()[0];
-  hud = HUDService.hudWeakReferences[hudId].get();
+  hud = HUDService.hudReferences[hudId];
 
   testOwnConsole();
 }
 
 function testConsoleOnPage(console) {
   isnot(console, undefined, "Console object defined on page");
   is(console.foo, "bar", "Custom console is not overwritten");
 }
--- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_execution_scope.js
+++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_execution_scope.js
@@ -50,17 +50,17 @@ function test() {
 function testExecutionScope() {
   browser.removeEventListener("DOMContentLoaded", testExecutionScope,
                               false);
 
   openConsole();
 
   let hudId = HUDService.displaysIndex()[0];
 
-  let HUD = HUDService.hudWeakReferences[hudId].get();
+  let HUD = HUDService.hudReferences[hudId];
   let jsterm = HUD.jsterm;
 
   jsterm.clearOutput();
   jsterm.execute("location;");
 
   let nodes = jsterm.outputNode.querySelectorAll(".hud-msg-node");
   is(nodes.length, 1, "Three children in output");
 
--- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_history.js
+++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_history.js
@@ -52,17 +52,17 @@ function test() {
 }
 
 function testHistory() {
   browser.removeEventListener("DOMContentLoaded", testHistory, false);
 
   openConsole();
 
   hudId = HUDService.displaysIndex()[0];
-  let HUD = HUDService.hudWeakReferences[hudId].get();
+  let HUD = HUDService.hudReferences[hudId];
   let jsterm = HUD.jsterm;
   let input = jsterm.inputNode;
 
   let executeList = ["document", "window", "window.location"];
 
   for each (var item in executeList) {
     input.value = item;
     jsterm.execute();
--- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_hud_getters.js
+++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_hud_getters.js
@@ -33,34 +33,34 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-// Tests that the HUD can be accessed via the HUD weak references in the HUD
+// Tests that the HUD can be accessed via the HUD references in the HUD
 // service.
 
 const TEST_URI = "http://example.com/browser/toolkit/components/console/hudservice/tests/browser/test-console.html";
 
 function test() {
   addTab(TEST_URI);
   browser.addEventListener("DOMContentLoaded", testHUDGetters, false);
 }
 
 function testHUDGetters() {
   browser.removeEventListener("DOMContentLoaded", testHUDGetters, false);
 
   openConsole();
 
   hudId = HUDService.displaysIndex()[0];
 
-  var HUD = HUDService.hudWeakReferences[hudId].get();
+  var HUD = HUDService.hudReferences[hudId];
   var jsterm = HUD.jsterm;
   var klass = jsterm.inputNode.getAttribute("class");
   ok(klass == "jsterm-input-node", "We have the input node.");
 
   var hudconsole = HUD.console;
   is(typeof hudconsole, "object", "HUD.console is an object");
   is(typeof hudconsole.log, "function", "HUD.console.log is a function");
   is(typeof hudconsole.info, "function", "HUD.console.info is a function");
--- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_js_input_and_output_styling.js
+++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_js_input_and_output_styling.js
@@ -52,17 +52,17 @@ function test() {
 function testJSInputAndOutputStyling() {
   browser.removeEventListener("DOMContentLoaded",
                               testJSInputAndOutputStyling, false);
 
   openConsole();
 
   hudId = HUDService.displaysIndex()[0];
 
-  let jsterm = HUDService.hudWeakReferences[hudId].get().jsterm;
+  let jsterm = HUDService.hudReferences[hudId].jsterm;
 
   jsterm.clearOutput();
   jsterm.execute("2 + 2");
 
   let nodes = jsterm.outputNode.querySelectorAll(".hud-msg-node");
   let jsInputNode = nodes[0];
   isnot(jsInputNode.textContent.indexOf("2 + 2"), -1,
     "JS input node contains '2 + 2'");
--- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_js_input_expansion.js
+++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_js_input_expansion.js
@@ -50,17 +50,17 @@ function test() {
 function testJSInputExpansion() {
   browser.removeEventListener("DOMContentLoaded", testJSInputExpansion,
                               false);
 
   openConsole();
 
   hudId = HUDService.displaysIndex()[0];
 
-  let HUD = HUDService.hudWeakReferences[hudId].get();
+  let HUD = HUDService.hudReferences[hudId];
   let jsterm = HUD.jsterm;
   let input = jsterm.inputNode;
   input.focus();
 
   is(input.getAttribute("multiline"), "true", "multiline is enabled");
   // Tests if the inputNode expands.
   input.value = "hello\nworld\n";
   let length = input.value.length;
--- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_jsterm.js
+++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_jsterm.js
@@ -57,17 +57,17 @@ function checkResult(msg, desc, lines) {
 function testJSTerm()
 {
   browser.removeEventListener("DOMContentLoaded", testJSTerm, false);
 
   openConsole();
 
   hudId = HUDService.displaysIndex()[0];
   let hudBox = HUDService.getHeadsUpDisplay(hudId);
-  hud = HUDService.hudWeakReferences[hudId].get();
+  hud = HUDService.hudReferences[hudId];
   jsterm = hud.jsterm;
   let outputNode = hudBox.querySelector(".hud-output-node");
 
   jsterm.clearOutput();
   jsterm.execute("'id=' + $('header').getAttribute('id')");
   checkResult("id=header", "$() worked", 1);
 
   jsterm.clearOutput();
--- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_null_and_undefined_output.js
+++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_null_and_undefined_output.js
@@ -52,17 +52,17 @@ function test() {
 function testNullAndUndefinedOutput() {
   browser.removeEventListener("DOMContentLoaded",
                               testNullAndUndefinedOutput, false);
 
   openConsole();
 
   hudId = HUDService.displaysIndex()[0];
 
-  let HUD = HUDService.hudWeakReferences[hudId].get();
+  let HUD = HUDService.hudReferences[hudId];
   let jsterm = HUD.jsterm;
   outputNode = jsterm.outputNode;
 
   jsterm.clearOutput();
   jsterm.execute("null;");
 
   let nodes = outputNode.querySelectorAll(".hud-msg-node");
   is(nodes.length, 2, "2 nodes in output");
--- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_output_order.js
+++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_output_order.js
@@ -50,17 +50,17 @@ function test() {
 
 function testOutputOrder() {
   browser.removeEventListener("DOMContentLoaded", testOutputOrder, false);
 
   openConsole();
 
   hudId = HUDService.displaysIndex()[0];
 
-  let HUD = HUDService.hudWeakReferences[hudId].get();
+  let HUD = HUDService.hudReferences[hudId];
   let jsterm = HUD.jsterm;
   outputNode = jsterm.outputNode;
 
   jsterm.clearOutput();
   jsterm.execute("console.log('foo', 'bar');");
 
   let nodes = outputNode.querySelectorAll(".hud-msg-node");
   is(nodes.length, 3, "3 children in output");
--- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_property_panel.js
+++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_property_panel.js
@@ -50,17 +50,17 @@ function test() {
 
 function testPropertyPanel() {
   browser.removeEventListener("DOMContentLoaded", testPropertyPanel, false);
 
   openConsole();
 
   hudId = HUDService.displaysIndex()[0];
 
-  var HUD = HUDService.hudWeakReferences[hudId].get();
+  var HUD = HUDService.hudReferences[hudId];
   var jsterm = HUD.jsterm;
 
   let propPanel = jsterm.openPropertyPanel("Test", [
     1,
     /abc/,
     null,
     undefined,
     function test() {},
--- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_property_provider.js
+++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_property_provider.js
@@ -51,17 +51,17 @@ function test() {
 function testPropertyProvider() {
   browser.removeEventListener("DOMContentLoaded", testPropertyProvider,
                               false);
 
   openConsole();
 
   hudId = HUDService.displaysIndex()[0];
 
-  var HUD = HUDService.hudWeakReferences[hudId].get();
+  var HUD = HUDService.hudReferences[hudId];
   var jsterm = HUD.jsterm;
   var context = jsterm.sandbox.window;
   var completion;
 
   // Test if the propertyProvider can be accessed from the jsterm object.
   ok (jsterm.propertyProvider !== undefined, "JSPropertyProvider is defined");
 
   completion = jsterm.propertyProvider(context, "thisIsNotDefined");