Bug 1271096 - Make sure source links can be tabbed into;r=fitzgen
authorBrian Grinstead <bgrinstead@mozilla.com>
Wed, 25 May 2016 16:24:01 -0700
changeset 299172 73817edbdfd6f66e75b13eeb9a883994d04f178d
parent 299171 9ef45b3ae61d40b772319a314205ddacfe00cff9
child 299173 c80d58a15cff0cecf948168917c45c50dbf473b1
push id77464
push userryanvm@gmail.com
push dateThu, 26 May 2016 15:22:37 +0000
treeherdermozilla-inbound@49beae179207 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfitzgen
bugs1271096
milestone49.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 1271096 - Make sure source links can be tabbed into;r=fitzgen MozReview-Commit-ID: FPwYQyLQw4m
devtools/client/shared/components/frame.js
devtools/client/shared/components/test/mochitest/head.js
devtools/client/shared/components/test/mochitest/test_frame_01.html
--- a/devtools/client/shared/components/frame.js
+++ b/devtools/client/shared/components/frame.js
@@ -98,17 +98,21 @@ module.exports = createClass({
       // Add `data-line` attribute for testing
       attributes["data-line"] = line;
     }
 
     // If source is not a URL (self-hosted, eval, etc.), don't make
     // it an anchor link, as we can't link to it.
     if (isLinkable) {
       sourceEl = dom.a({
-        onClick,
+        onClick: e => {
+          e.preventDefault();
+          onClick(e);
+        },
+        href: source,
         className: "frame-link-source",
         title: l10n.getFormatStr("frame.viewsourceindebugger", tooltip)
       }, sourceElements);
     } else {
       sourceEl = dom.span({
         className: "frame-link-source",
         title: tooltip,
       }, sourceElements);
--- a/devtools/client/shared/components/test/mochitest/head.js
+++ b/devtools/client/shared/components/test/mochitest/head.js
@@ -136,30 +136,33 @@ var TEST_TREE = {
     O: "N"
   },
   expanded: new Set(),
 };
 
 /**
  * Frame
  */
-function checkFrameString({ frame, file, line, column, shouldLink, tooltip }) {
+function checkFrameString({ frame, file, line, column, source, shouldLink, tooltip }) {
   let el = frame.getDOMNode();
   let $ = selector => el.querySelector(selector);
 
   let $source = $(".frame-link-source");
   let $filename = $(".frame-link-filename");
   let $line = $(".frame-link-line");
   let $column = $(".frame-link-column");
 
   is($filename.textContent, file, "Correct filename");
   is(el.getAttribute("data-line"), line ? `${line}` : null, "Expected `data-line` found");
   is(el.getAttribute("data-column"), column ? `${column}` : null, "Expected `data-column` found");
   is($source.getAttribute("title"), tooltip, "Correct tooltip");
   is($source.tagName, shouldLink ? "A" : "SPAN", "Correct linkable status");
+  if (shouldLink) {
+    is($source.getAttribute("href"), source, "Correct source");
+  }
 
   if (line != null) {
     is(+$line.textContent, +line);
   } else {
     ok(!$line, "Should not have an element for `line`");
   }
 
   if (column != null) {
--- a/devtools/client/shared/components/test/mochitest/test_frame_01.html
+++ b/devtools/client/shared/components/test/mochitest/test_frame_01.html
@@ -142,17 +142,18 @@ window.onload = Task.async(function* () 
     });
 
     function* checkFrameComponent (input, expected) {
       let frame = ReactDOM.render(Frame({
         frame: input,
         onClick: () => {},
       }), window.document.body);
       yield forceRender(frame);
-      checkFrameString(Object.assign({ frame }, expected));
+      let source = input.source;
+      checkFrameString(Object.assign({ frame, source }, expected));
     }
 
   } catch (e) {
     ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
   } finally {
     SimpleTest.finish();
   }
 });