Bug 1185243 - Toggle for Rulers doesn't work correctly. r=mratcliffe
authorMatteo Ferretti <mferretti@mozilla.com>
Thu, 30 Jul 2015 08:28:00 +0200
changeset 288452 0c4e37a634218d718c4a4e84ca802c604741acab
parent 288451 1102281dff1188bbd33591075d5dfaab7ef2bb09
child 288453 ff027361bff1cf7afcbca49714bbd369b3297f7b
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmratcliffe
bugs1185243
milestone42.0a1
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
Bug 1185243 - Toggle for Rulers doesn't work correctly. r=mratcliffe
toolkit/devtools/gcli/commands/rulers.js
--- a/toolkit/devtools/gcli/commands/rulers.js
+++ b/toolkit/devtools/gcli/commands/rulers.js
@@ -54,42 +54,42 @@ exports.items = [
   // The server rulers command is hidden by default, it's just used by the
   // client command.
   {
     name: "rulers_server",
     runAt: "server",
     hidden: true,
     exec: function(args, context) {
       let env = context.environment;
+      let { document } = env;
 
       // Calling the command again after the rulers have been shown once hides
       // them.
-      if (highlighters.has(env.document)) {
-        let { highlighter, environment } = highlighters.get(env.document);
+      if (highlighters.has(document)) {
+        let { highlighter } = highlighters.get(document);
         highlighter.destroy();
-        environment.destroy();
         return false;
       }
 
       // Otherwise, display the rulers.
       let environment = new HighlighterEnvironment();
       environment.initFromWindow(env.window);
       let highlighter = new RulersHighlighter(environment);
 
       // Store the instance of the rulers highlighter for this document so we
       // can hide it later.
-      highlighters.set(env.document, { highlighter, environment });
+      highlighters.set(document, { highlighter, environment });
 
       // Listen to the highlighter's destroy event which may happen if the
       // window is refreshed or closed with the rulers shown.
       events.once(highlighter, "destroy", () => {
-        if (highlighters.has(env.document)) {
-          let { environment } = highlighters.get(env.document);
+        if (highlighters.has(document)) {
+          let { environment } = highlighters.get(document);
           environment.destroy();
-          highlighters.delete(env.document);
+          highlighters.delete(document);
         }
       });
 
       highlighter.show();
       return true;
     }
   }
 ];