Bug 1227139 - Fix the webconsole for addon and browser content toolbox by handling a missing performance property on this.window. r=bgrins, a=ritu
authorAlexandre Poirot <poirot.alex@gmail.com>
Wed, 25 Nov 2015 07:54:26 -0800
changeset 305691 5b1d1495f58eabdd5ed89e2012c045b597402603
parent 305690 cfcf9ab4f70505ab3b4058e957f16a92026b035b
child 305692 3f436da478d140be995b708190369cc7483f0b2d
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbgrins, ritu
bugs1227139
milestone44.0a2
Bug 1227139 - Fix the webconsole for addon and browser content toolbox by handling a missing performance property on this.window. r=bgrins, a=ritu
devtools/server/actors/webconsole.js
--- a/devtools/server/actors/webconsole.js
+++ b/devtools/server/actors/webconsole.js
@@ -152,18 +152,22 @@ WebConsoleActor.prototype =
    * @type boolean
    */
   get _parentIsContentActor() {
     return "ContentActor" in DebuggerServer &&
             this.parentActor instanceof DebuggerServer.ContentActor;
   },
 
   /**
-   * The window we work with.
-   * @type nsIDOMWindow
+   * The window or sandbox we work with.
+   * Note that even if it is named `window` it refers to the current
+   * global we are debugging, which can be a Sandbox for addons
+   * or browser content toolbox.
+   *
+   * @type nsIDOMWindow or Sandbox
    */
   get window() {
     if (this.parentActor.isRootActor) {
       return this._getWindowForBrowserConsole();
     }
     return this.parentActor.window;
   },
 
@@ -728,17 +732,18 @@ WebConsoleActor.prototype =
     while (types.length > 0) {
       let type = types.shift();
       switch (type) {
         case "ConsoleAPI": {
           if (!this.consoleAPIListener) {
             break;
           }
 
-          let requestStartTime = this.window ?
+          // See `window` definition. It isn't always a DOM Window.
+          let requestStartTime = this.window && this.window.performance ?
             this.window.performance.timing.requestStart : 0;
 
           let cache = this.consoleAPIListener
                       .getCachedMessages(!this.parentActor.isRootActor);
           cache.forEach((aMessage) => {
             // Filter out messages that came from a ServiceWorker but happened
             // before the page was requested.
             if (aMessage.innerID === "ServiceWorker" &&