Bug 1319638 - Part 2: Change line number of a function created by Function constructor to start from 1. r=shu
authorTooru Fujisawa <arai_a@mac.com>
Wed, 01 Mar 2017 13:34:45 +0900
changeset 374301 182d11502abef1b63c6225f28d3629a04dfb9514
parent 374300 21725697b47bb567ea027e3f91faf333c76e43c8
child 374302 a3d1476da61fcb6278703f9ade471e20fe01978a
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersshu
bugs1319638
milestone54.0a1
Bug 1319638 - Part 2: Change line number of a function created by Function constructor to start from 1. r=shu
devtools/client/inspector/markup/test/browser_markup_events_04.js
js/src/jsfun.cpp
--- a/devtools/client/inspector/markup/test/browser_markup_events_04.js
+++ b/devtools/client/inspector/markup/test/browser_markup_events_04.js
@@ -51,33 +51,33 @@ const TEST_DATA = [ // eslint-disable-li
       },
     ]
   },
   {
     selector: "#constructed-function",
     expected: [
       {
         type: "click",
-        filename: TEST_URL,
+        filename: TEST_URL + ":1",
         attributes: [
           "Bubbling",
           "DOM2"
         ],
         handler: "function anonymous() {\n" +
                  "\n" +
                  "}"
       }
     ]
   },
   {
     selector: "#constructed-function-with-body-string",
     expected: [
       {
         type: "click",
-        filename: TEST_URL,
+        filename: TEST_URL + ":1",
         attributes: [
           "Bubbling",
           "DOM2"
         ],
         handler: "function anonymous(a, b, c) {\n" +
                  "  alert(\"constructedFuncWithBodyString\");\n" +
         "}"
       }
--- a/js/src/jsfun.cpp
+++ b/js/src/jsfun.cpp
@@ -1618,19 +1618,18 @@ FunctionConstructor(JSContext* cx, const
     else if (generatorKind != NotGenerator)
         introductionType = "GeneratorFunction";
 
     const char* introducerFilename = filename;
     if (maybeScript && maybeScript->scriptSource()->introducerFilename())
         introducerFilename = maybeScript->scriptSource()->introducerFilename();
 
     CompileOptions options(cx);
-    // Use line 0 to make the function body starts from line 1.
     options.setMutedErrors(mutedErrors)
-           .setFileAndLine(filename, 0)
+           .setFileAndLine(filename, 1)
            .setNoScriptRval(false)
            .setIntroductionInfo(introducerFilename, introductionType, lineno, maybeScript, pcOffset);
 
     StringBuffer sb(cx);
 
     if (!sb.append('('))
         return false;