Back out eb203c9db11d (bug 1107541) for e10s dt bustage
authorPhil Ringnalda <philringnalda@gmail.com>
Mon, 08 Dec 2014 20:24:52 -0800
changeset 218748 b46dc702c59c020bd5e1d2ed238e726affa4f053
parent 218747 24f1cc4e2e329403d536b467fe2f6e0bd2b30d5d
child 218749 210fcdc74cde38e9293a04583c6764e54fb2e565
child 218835 47f0671e2c65bc2db2bf121f02ad1ed393da2b95
push id10302
push userphilringnalda@gmail.com
push dateTue, 09 Dec 2014 04:25:06 +0000
treeherderfx-team@b46dc702c59c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1107541
milestone37.0a1
backs outeb203c9db11de72c79bb452144d3dfc31bd22168
Back out eb203c9db11d (bug 1107541) for e10s dt bustage CLOSED TREE
browser/devtools/debugger/debugger-panes.js
browser/devtools/debugger/test/browser.ini
browser/devtools/debugger/test/browser_dbg_sources-eval-01.js
browser/devtools/debugger/test/browser_dbg_sources-eval-02.js
browser/devtools/debugger/test/browser_dbg_sources-eval.js
browser/devtools/debugger/test/code_script-eval.js
browser/devtools/debugger/test/doc_script-eval.html
toolkit/devtools/moz.build
toolkit/devtools/path.js
toolkit/devtools/server/actors/script.js
--- a/browser/devtools/debugger/debugger-panes.js
+++ b/browser/devtools/debugger/debugger-panes.js
@@ -166,17 +166,17 @@ SourcesView.prototype = Heritage.extend(
     });
   },
 
   _parseUrl: function(aSource) {
     let fullUrl = aSource.url || aSource.introductionUrl;
     let url = fullUrl.split(" -> ").pop();
     let label = aSource.addonPath ? aSource.addonPath : SourceUtils.getSourceLabel(url);
 
-    if (!aSource.url && aSource.introductionUrl) {
+    if (aSource.introductionUrl) {
       label += ' > eval';
     }
 
     return {
       label: label,
       group: aSource.addonID ? aSource.addonID : SourceUtils.getSourceGroup(url),
       unicodeUrl: NetworkHelper.convertToUnicode(unescape(fullUrl))
     };
--- a/browser/devtools/debugger/test/browser.ini
+++ b/browser/devtools/debugger/test/browser.ini
@@ -400,19 +400,17 @@ skip-if = e10s && debug
 [browser_dbg_source-maps-02.js]
 skip-if = e10s && debug
 [browser_dbg_source-maps-03.js]
 skip-if = e10s && debug
 [browser_dbg_source-maps-04.js]
 skip-if = e10s # Bug 1093535
 [browser_dbg_sources-cache.js]
 skip-if = e10s && debug
-[browser_dbg_sources-eval-01.js]
-skip-if = e10s && debug
-[browser_dbg_sources-eval-02.js]
+[browser_dbg_sources-eval.js]
 skip-if = e10s && debug
 [browser_dbg_sources-labels.js]
 skip-if = e10s && debug
 [browser_dbg_sources-sorting.js]
 skip-if = e10s && debug
 [browser_dbg_split-console-paused-reload.js]
 skip-if = e10s && debug
 [browser_dbg_stack-01.js]
deleted file mode 100644
--- a/browser/devtools/debugger/test/browser_dbg_sources-eval-01.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure eval scripts appear in the source list
- */
-
-const TAB_URL = EXAMPLE_URL + "doc_script-eval.html";
-
-function test() {
-  let gTab, gPanel, gDebugger;
-  let gSources, gBreakpoints;
-
-  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
-    gTab = aTab;
-    gPanel = aPanel;
-    gDebugger = gPanel.panelWin;
-    gSources = gDebugger.DebuggerView.Sources;
-    gBreakpoints = gDebugger.DebuggerController.Breakpoints;
-
-    return Task.spawn(function*() {
-      yield waitForSourceShown(gPanel, "-eval.js");
-      is(gSources.values.length, 1, "Should have 1 source");
-
-      let newSource = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.NEW_SOURCE);
-      callInTab(gTab, "evalSource");
-      yield newSource;
-
-      is(gSources.values.length, 2, "Should have 2 sources");
-
-      yield closeDebuggerAndFinish(gPanel);
-    });
-  });
-}
deleted file mode 100644
--- a/browser/devtools/debugger/test/browser_dbg_sources-eval-02.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure eval scripts with the sourceURL pragma are correctly
- * displayed
- */
-
-const TAB_URL = EXAMPLE_URL + "doc_script-eval.html";
-
-function test() {
-  let gTab, gPanel, gDebugger;
-  let gSources, gBreakpoints, gEditor;
-
-  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
-    gTab = aTab;
-    gPanel = aPanel;
-    gDebugger = gPanel.panelWin;
-    gSources = gDebugger.DebuggerView.Sources;
-    gBreakpoints = gDebugger.DebuggerController.Breakpoints;
-    gEditor = gDebugger.DebuggerView.editor;
-
-    return Task.spawn(function*() {
-      yield waitForSourceShown(gPanel, "-eval.js");
-      is(gSources.values.length, 1, "Should have 1 source");
-
-      let newSource = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.NEW_SOURCE);
-      callInTab(gTab, "evalSourceWithSourceURL");
-      yield newSource;
-
-      is(gSources.values.length, 2, "Should have 2 sources");
-
-      let item = gSources.getItemForAttachment(e => e.label == "bar.js");
-      ok(item, "Source label is incorrect.");
-      ok(item.attachment.group === 'http://example.com', 'Source group is incorrect');
-
-      let shown = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_SHOWN);
-      gSources.selectedItem = item;
-      yield shown;
-
-      ok(gEditor.getText().indexOf('bar = function() {') === 0,
-         'Correct source is shown');
-
-      yield closeDebuggerAndFinish(gPanel);
-    });
-  });
-}
new file mode 100644
--- /dev/null
+++ b/browser/devtools/debugger/test/browser_dbg_sources-eval.js
@@ -0,0 +1,41 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/**
+ * Make sure eval scripts appear in the source list
+ */
+
+const TAB_URL = EXAMPLE_URL + "doc_script-eval.html";
+
+function test() {
+  let gTab, gPanel, gDebugger;
+  let gSources, gBreakpoints;
+
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
+    gTab = aTab;
+    gPanel = aPanel;
+    gDebugger = gPanel.panelWin;
+    gSources = gDebugger.DebuggerView.Sources;
+    gBreakpoints = gDebugger.DebuggerController.Breakpoints;
+
+    waitForSourceShown(gPanel, "-eval.js")
+      .then(run)
+      .then(null, aError => {
+        ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
+      });
+  });
+
+  function run() {
+    return Task.spawn(function*() {
+      is(gSources.values.length, 1, "Should have 1 source");
+
+      let newSource = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.NEW_SOURCE);
+      callInTab(gTab, "evalSource");
+      yield newSource;
+
+      is(gSources.values.length, 2, "Should have 2 sources");
+
+      yield closeDebuggerAndFinish(gPanel);
+    });
+  }
+}
--- a/browser/devtools/debugger/test/code_script-eval.js
+++ b/browser/devtools/debugger/test/code_script-eval.js
@@ -1,10 +1,6 @@
 
 var bar;
 
 function evalSource() {
   eval('bar = function() {\nvar x = 5;\n}');
 }
-
-function evalSourceWithSourceURL() {
-   eval('bar = function() {\nvar x = 6;\n} //# sourceURL=bar.js');
-}
--- a/browser/devtools/debugger/test/doc_script-eval.html
+++ b/browser/devtools/debugger/test/doc_script-eval.html
@@ -8,9 +8,10 @@
     <title>Debugger test page</title>
   </head>
 
   <body>
     <button onclick="evalSource()">Click me!</button>
 
     <script type="text/javascript" src="code_script-eval.js"></script>
   </body>
+
 </html>
--- a/toolkit/devtools/moz.build
+++ b/toolkit/devtools/moz.build
@@ -29,17 +29,16 @@ EXTRA_JS_MODULES.devtools += [
     'async-utils.js',
     'content-observer.js',
     'css-color.js',
     'deprecated-sync-thenables.js',
     'DevToolsUtils.js',
     'event-emitter.js',
     'event-parsers.js',
     'output-parser.js',
-    'path.js',
     'touch-events.js',
     'worker-loader.js',
 ]
 
 EXTRA_JS_MODULES.devtools += [
     'Console.jsm',
     'DevToolsUtils.jsm',
     'LayoutHelpers.jsm',
deleted file mode 100644
--- a/toolkit/devtools/path.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict";
-
-/*
- * Returns the directory name of the path
- */
-exports.dirname = path => {
-  return Services.io.newURI(
-    ".", null, Services.io.newURI(path, null, null)).spec;
-}
-
-/*
- * Join all the arguments together and normalize the resulting URI.
- * The initial path must be an full URI with a protocol (i.e. http://).
- */
-exports.joinURI = (initialPath, ...paths) => {
-  let uri;
-
-  try {
-    uri = Services.io.newURI(initialPath, null, null);
-  }
-  catch(e) {
-    return;
-  }
-
-  for(let path of paths) {
-    if(path) {
-      uri = Services.io.newURI(path, null, uri);
-    }
-  }
-
-  return uri.spec;
-}
--- a/toolkit/devtools/server/actors/script.js
+++ b/toolkit/devtools/server/actors/script.js
@@ -7,17 +7,16 @@
 "use strict";
 
 const Services = require("Services");
 const { Cc, Ci, Cu, components, ChromeWorker } = require("chrome");
 const { ActorPool, getOffsetColumn } = require("devtools/server/actors/common");
 const { DebuggerServer } = require("devtools/server/main");
 const DevToolsUtils = require("devtools/toolkit/DevToolsUtils");
 const { dbg_assert, dumpn, update, fetch } = DevToolsUtils;
-const { dirname, joinURI } = require("devtools/toolkit/path");
 const { SourceMapConsumer, SourceMapGenerator } = require("source-map");
 const promise = require("promise");
 const PromiseDebugging = require("PromiseDebugging");
 const Debugger = require("Debugger");
 const xpcInspector = require("xpcInspector");
 const mapURIToAddonID = require("./utils/map-uri-to-addon-id");
 
 const { defer, resolve, reject, all } = require("devtools/toolkit/deprecated-sync-thenables");
@@ -5360,19 +5359,17 @@ ThreadSources.prototype = {
       return MINIFIED_SOURCE_REGEXP.test(aURL);
     }
   },
 
   /**
    * Only to be used when we aren't source mapping.
    */
   _sourceForScript: function (aScript) {
-    // Don't use getSourceURL because we don't want to consider the
-    // displayURL property if it's an eval source
-    let url = isEvalSource(aScript.source) ? null : aScript.source.url;
+    let url = getSourceURL(aScript.source);
     let spec = {
       source: aScript.source
     };
 
     // XXX bug 915433: We can't rely on Debugger.Source.prototype.text
     // if the source is an HTML-embedded <script> tag. Since we don't
     // have an API implemented to detect whether this is the case, we
     // need to be conservative and only treat valid js files as real
@@ -5853,36 +5850,23 @@ function getInnerId(window) {
 
 const symbolProtoToString = typeof Symbol === "function" ? Symbol.prototype.toString : null;
 
 function getSymbolName(symbol) {
   const name = symbolProtoToString.call(symbol).slice("Symbol(".length, -1);
   return name || undefined;
 }
 
-function isEvalSource(source) {
+function getSourceURL(source) {
   let introType = source.introductionType;
   // These are all the sources that are essentially eval-ed (either
   // by calling eval or passing a string to one of these functions).
-  return (introType === 'eval' ||
-          introType === 'Function' ||
-          introType === 'eventHandler' ||
-          introType === 'setTimeout' ||
-          introType === 'setInterval');
-}
-
-function getSourceURL(source) {
-  if(isEvalSource(source)) {
-    // Eval sources have no urls, but they might have a `displayURL`
-    // created with the sourceURL pragma. If the introduction script
-    // is a non-eval script, generate an full absolute URL relative to it.
-
-    if(source.displayURL &&
-       source.introductionScript &&
-       !isEvalSource(source.introductionScript.source)) {
-      return joinURI(dirname(source.introductionScript.source.url),
-                     source.displayURL);
-    }
-
+  // Current these have a `url` property when the shouldn't, so
+  // forcefully only consider displayURL
+  if (introType === 'eval' ||
+      introType === 'Function' ||
+      introType === 'eventHandler' ||
+      introType === 'setTimeout' ||
+      introType === 'setInterval') {
     return source.displayURL;
   }
   return source.url;
 }