Backed out changeset fd1505a03d78 for mochitest chrome bustage (bug 1315242)
authorTooru Fujisawa <arai_a@mac.com>
Fri, 11 Nov 2016 03:04:46 +0900
changeset 352110 6f3b378f627f6fe3288bd0c4b193bec23badba2b
parent 352109 7b1fd4bf3ac16abd6e718260050046f4dbe1db11
child 352111 f7fd4165f57668b6fff6fc024957e357362ac83a
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1315242
milestone52.0a1
backs outfd1505a03d78c38a05fac455c28539ef05686bfe
Backed out changeset fd1505a03d78 for mochitest chrome bustage (bug 1315242)
devtools/client/shared/components/frame.js
devtools/client/webconsole/new-console-output/components/message-types/evaluation-result.js
devtools/client/webconsole/new-console-output/components/message.js
devtools/client/webconsole/new-console-output/utils/messages.js
devtools/server/actors/webconsole.js
--- a/devtools/client/shared/components/frame.js
+++ b/devtools/client/shared/components/frame.js
@@ -142,18 +142,24 @@ module.exports = createClass({
     const isLinkable = !!(isScratchpadScheme(source) || parseURL(source))
       || isSourceMapped;
     const elements = [];
     const sourceElements = [];
     let sourceEl;
 
     let tooltip = long;
 
-    // Exclude all falsy values, including `0`, as line numbers start with 1.
-    if (line) {
+    // If the source is linkable and line > 0
+    const shouldDisplayLine = isLinkable && line;
+
+    // Exclude all falsy values, including `0`, as even
+    // a number 0 for line doesn't make sense, and should not be displayed.
+    // If source isn't linkable, don't attempt to append line and column
+    // info, as this probably doesn't make sense.
+    if (shouldDisplayLine) {
       tooltip += `:${line}`;
       // Intentionally exclude 0
       if (column) {
         tooltip += `:${column}`;
       }
     }
 
     let attributes = {
@@ -182,18 +188,18 @@ module.exports = createClass({
     } else if (showEmptyPathAsHost && (displaySource === "" || displaySource === "/")) {
       displaySource = host;
     }
 
     sourceElements.push(dom.span({
       className: "frame-link-filename",
     }, displaySource));
 
-    // If we have a line number > 0.
-    if (line) {
+    // If source is linkable, and we have a line number > 0
+    if (shouldDisplayLine) {
       let lineInfo = `:${line}`;
       // Add `data-line` attribute for testing
       attributes["data-line"] = line;
 
       // Intentionally exclude 0
       if (column) {
         lineInfo += `:${column}`;
         // Add `data-column` attribute for testing
--- a/devtools/client/webconsole/new-console-output/components/message-types/evaluation-result.js
+++ b/devtools/client/webconsole/new-console-output/components/message-types/evaluation-result.js
@@ -28,17 +28,16 @@ EvaluationResult.defaultProps = {
 function EvaluationResult(props) {
   const { message, serviceContainer, indent } = props;
   const {
     source,
     type,
     level,
     id: messageId,
     exceptionDocURL,
-    frame,
   } = message;
 
   let messageBody;
   if (message.messageText) {
     messageBody = message.messageText;
   } else {
     messageBody = GripMessageBody({grip: message.parameters});
   }
@@ -51,14 +50,13 @@ function EvaluationResult(props) {
     level,
     indent,
     topLevelClasses,
     messageBody,
     messageId,
     scrollToMessage: props.autoscroll,
     serviceContainer,
     exceptionDocURL,
-    frame,
   };
   return Message(childProps);
 }
 
 module.exports = EvaluationResult;
--- a/devtools/client/webconsole/new-console-output/components/message.js
+++ b/devtools/client/webconsole/new-console-output/components/message.js
@@ -125,22 +125,23 @@ const Message = createClass({
           }
         },
       });
     }
 
     const repeat = this.props.repeat ? MessageRepeat({repeat: this.props.repeat}) : null;
 
     // Configure the location.
+    const shouldRenderFrame = frame && frame.source !== "debugger eval code";
     const location = dom.span({ className: "message-location devtools-monospace" },
-      frame ? FrameView({
+      shouldRenderFrame ? FrameView({
         frame,
-        onClick: serviceContainer ? serviceContainer.onViewSourceInDebugger : undefined,
+        onClick: serviceContainer.onViewSourceInDebugger,
         showEmptyPathAsHost: true,
-        sourceMapService: serviceContainer ? serviceContainer.sourceMapService : undefined
+        sourceMapService: serviceContainer.sourceMapService
       }) : null
     );
 
     let learnMore;
     if (exceptionDocURL) {
       learnMore = dom.a({
         className: "learn-more-link webconsole-learn-more-link",
         title: exceptionDocURL.split("?")[0],
--- a/devtools/client/webconsole/new-console-output/utils/messages.js
+++ b/devtools/client/webconsole/new-console-output/utils/messages.js
@@ -179,29 +179,27 @@ function transformPacket(packet) {
       });
     }
 
     case "evaluationResult":
     default: {
       let {
         exceptionMessage: messageText,
         exceptionDocURL,
-        frame,
         result: parameters
       } = packet;
 
       const level = messageText ? MESSAGE_LEVEL.ERROR : MESSAGE_LEVEL.LOG;
       return new ConsoleMessage({
         source: MESSAGE_SOURCE.JAVASCRIPT,
         type: MESSAGE_TYPE.RESULT,
         level,
         messageText,
         parameters,
         exceptionDocURL,
-        frame,
       });
     }
   }
 }
 
 // Helpers
 function getRepeatId(message) {
   message = message.toJS();
--- a/devtools/server/actors/webconsole.js
+++ b/devtools/server/actors/webconsole.js
@@ -883,17 +883,17 @@ WebConsoleActor.prototype =
       selectedNodeActor: aRequest.selectedNodeActor,
       selectedObjectActor: aRequest.selectedObjectActor,
     };
 
     let evalInfo = this.evalWithDebugger(input, evalOptions);
     let evalResult = evalInfo.result;
     let helperResult = evalInfo.helperResult;
 
-    let result, errorDocURL, errorMessage, errorGrip = null, frame = null;
+    let result, errorDocURL, errorMessage, errorGrip = null;
     if (evalResult) {
       if ("return" in evalResult) {
         result = evalResult.return;
       } else if ("yield" in evalResult) {
         result = evalResult.yield;
       } else if ("throw" in evalResult) {
         let error = evalResult.throw;
 
@@ -924,30 +924,16 @@ WebConsoleActor.prototype =
           }
         }
 
         // It is possible that we won't have permission to unwrap an
         // object and retrieve its errorMessageName.
         try {
           errorDocURL = ErrorDocs.GetURL(error);
         } catch (ex) {}
-
-        try {
-          let line = error.errorLineNumber;
-          let column = error.errorColumnNumber;
-
-          if (typeof line === "number" && typeof column === "number") {
-            // Set frame only if we have line/column numbers.
-            frame = {
-              source: "debugger eval code",
-              line,
-              column
-            };
-          }
-        } catch (ex) {}
       }
     }
 
     // If a value is encountered that the debugger server doesn't support yet,
     // the console should remain functional.
     let resultGrip;
     try {
       resultGrip = this.createValueGrip(result);
@@ -960,17 +946,16 @@ WebConsoleActor.prototype =
     return {
       from: this.actorID,
       input: input,
       result: resultGrip,
       timestamp: timestamp,
       exception: errorGrip,
       exceptionMessage: this._createStringGrip(errorMessage),
       exceptionDocURL: errorDocURL,
-      frame,
       helperResult: helperResult,
     };
   },
 
   /**
    * The Autocomplete request handler.
    *
    * @param object aRequest
@@ -1213,27 +1198,27 @@ WebConsoleActor.prototype =
    *        - selectedObjectActor: Like bindObjectActor, but executes with the
    *          top level window as the global.
    *        - frameActor: the FrameActor ID to use for evaluation. The given
    *        debugger frame is used for evaluation, instead of the global window.
    *        - selectedNodeActor: the NodeActor ID of the currently selected node
    *        in the Inspector (or null, if there is no selection). This is used
    *        for helper functions that make reference to the currently selected
    *        node, like $0.
-   *         - url: the url to evaluate the script as. Defaults to
-   *         "debugger eval code".
    * @return object
    *         An object that holds the following properties:
    *         - dbg: the debugger where the string was evaluated.
    *         - frame: (optional) the frame where the string was evaluated.
    *         - window: the Debugger.Object for the global where the string was
    *         evaluated.
    *         - result: the result of the evaluation.
    *         - helperResult: any result coming from a Web Console commands
    *         function.
+   *         - url: the url to evaluate the script as. Defaults to
+   *         "debugger eval code".
    */
   evalWithDebugger: function WCA_evalWithDebugger(aString, aOptions = {})
   {
     let trimmedString = aString.trim();
     // The help function needs to be easy to guess, so we make the () optional.
     if (trimmedString == "help" || trimmedString == "?") {
       aString = "help()";
     }