diff --git a/testing/extensions/community/chrome/content/common.js b/testing/extensions/community/chrome/content/common.js index 3a805af44cf..e4827448053 100755 --- a/testing/extensions/community/chrome/content/common.js +++ b/testing/extensions/community/chrome/content/common.js @@ -19,6 +19,7 @@ * * Contributor(s): * Zach Lipton + * Ben Hsieh * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or @@ -32,7 +33,7 @@ * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * -* ***** END LICENSE BLOCK ***** */ + * ***** END LICENSE BLOCK ***** */ const Ci = Components.interfaces; @@ -153,9 +154,21 @@ var qaTools = { }, - linkTargetsToBlank : function(node) { + assignLinkHandlers : function(node) { var children = node.getElementsByTagName('a'); for (var i = 0; i < children.length; i++) - children[i].setAttribute("target", "_blank"); - } + children[i].addEventListener("click", qaTools.handleLink, false); + }, + assignLinkHandler : function(link) { + link.addEventListener("click", qaTools.handleLink, false); + }, + handleLink : function(event) { + var url = this.href; + var type = qaPref.getPref("browser.link.open_external", "int"); + var where = "tab"; + if (type == 2) where = "window"; + + openUILinkIn(url, where); + event.preventDefault(); // prevent it from simply following the href + }, }; diff --git a/testing/extensions/community/chrome/content/litmus.js b/testing/extensions/community/chrome/content/litmus.js index 877e2860c1b..e5435a0bae9 100755 --- a/testing/extensions/community/chrome/content/litmus.js +++ b/testing/extensions/community/chrome/content/litmus.js @@ -247,8 +247,8 @@ qaTools.writeSafeHTML('qa-testcase-steps', testcase.steps_formatted); qaTools.writeSafeHTML('qa-testcase-expected', testcase.expected_results_formatted); - qaTools.linkTargetsToBlank($('qa-testcase-steps')); - qaTools.linkTargetsToBlank($('qa-testcase-expected')); + qaTools.assignLinkHandlers($('qa-testcase-steps')); + qaTools.assignLinkHandlers($('qa-testcase-expected')); litmus.checkRadioButtons(); }, diff --git a/testing/extensions/community/chrome/content/qa.xul b/testing/extensions/community/chrome/content/qa.xul index 4060048b407..318235d5268 100644 --- a/testing/extensions/community/chrome/content/qa.xul +++ b/testing/extensions/community/chrome/content/qa.xul @@ -36,6 +36,7 @@ # ***** END LICENSE BLOCK ***** --> + @@ -64,6 +65,7 @@ + @@ -61,8 +67,8 @@