Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 346513 - TextResult link with target=_blank doesn't work
Summary: TextResult link with target=_blank doesn't work
Status: RESOLVED FIXED
Alias: None
Product: MAT
Classification: Tools
Component: GUI (show other bugs)
Version: 1.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 1.11.0   Edit
Assignee: Andrew Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-19 13:40 EDT by Kevin Grigorenko CLA
Modified: 2020-10-19 14:59 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Grigorenko CLA 2011-05-19 13:40:18 EDT
Build Identifier: 

I would like to add a link to a webpage in a TextResult (with html=true). If I add an <a href="">...</a> tag then, when clicked, the page is loaded in the existing tab which is awkward -- there is no way to go back (i.e. right click doesn't work -- I'm running on Linux). If I add target="_blank" then the link no longer works. Perhaps the default for a normal link should launch the user's default web browser instead?

Reproducible: Always

Steps to Reproduce:
new TextResult("Click <a href=\"http://www.eclipse.org/\">here</a>", true);
Comment 1 Andrew Johnson CLA 2011-11-01 17:28:24 EDT
For information, it works as expected on Windows 7 - the first one launches the page inside MAT, and the right click has a back option, the target="_blank" opens an external browser.
Comment 2 Kevin Grigorenko CLA 2011-11-14 13:46:06 EST
(In reply to comment #1)
> For information, it works as expected on Windows 7 - the first one launches the
> page inside MAT, and the right click has a back option, the target="_blank"
> opens an external browser.

Ok, so this must be a problem with the Linux based browser integration
Comment 3 Andrew Johnson CLA 2019-11-01 14:21:19 EDT
All reports (e.g. leak suspects) have the following at the bottom right corner. I guess they have the same problem on Linux; Windows works fine.

Created by <a href="http://www.eclipse.org/mat/" target="_blank">Eclipse Memory Analyzer</a>
Comment 4 Kevin Grigorenko CLA 2019-11-11 13:18:12 EST
Yes, I just tested this on Fedora 31 and the issue still exists.

I recently created a WAS and Java lab which includes Docker and allows Windows and Mac users to run a Linux VM on Docker with various WAS and Java tools: https://hub.docker.com/r/kgibm/fedorawasdebug

This problem is reproducible with: 1) run the above docker image, 2) vnc into it, 3) double click MAT on the desktop, 4) open a heapdump from /opt/dockerdebug/fedorawasdebug/supplemental/exampledata/liberty/verbosegc_and_oom/*.phd, 5) run leak suspects, 6) click on the Eclipse Memory Analyzer link in the bottom right.
Comment 5 Andrew Johnson CLA 2020-02-17 10:25:10 EST
See https://www.eclipse.org/forums/index.php/t/164766/
Possibly use:
            browser.addOpenWindowListener(new OpenWindowListener()
Comment 7 Eclipse Genie CLA 2020-02-25 11:22:22 EST
New Gerrit change created: https://git.eclipse.org/r/158330
Comment 9 Eclipse Genie CLA 2020-02-25 12:10:28 EST
New Gerrit change created: https://git.eclipse.org/r/158338
Comment 11 Andrew Johnson CLA 2020-02-25 13:16:13 EST
The change didn't work on a Docker Ubuntu image.

Clicking on the 'Created by Eclipse Memory Analyzer' link caused MAT to crash:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f4807785ddf, pid=24, tid=25
#
# JRE version: OpenJDK Runtime Environment (11.0.6+10) (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1)
# Java VM: OpenJDK 64-Bit Server VM (11.0.6+10-post-Ubuntu-1ubuntu118.04.1, mixed mode, sharing, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# C  [libwebkit2gtk-4.0.so.37+0x87bddf]
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# //hs_err_pid24.log
#
# If you would like to submit a bug report, please visit:
#   https://bugs.launchpad.net/ubuntu/+source/openjdk-lts
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

On the Welcome page, clicking on 'Memory Analyzer @ Eclipse.org' does work, and brings up Firefox.
Comment 12 Eclipse Genie CLA 2020-02-25 16:05:53 EST
New Gerrit change created: https://git.eclipse.org/r/158349
Comment 14 Eclipse Genie CLA 2020-10-18 11:11:18 EDT
New Gerrit change created: https://git.eclipse.org/r/c/mat/org.eclipse.mat/+/170912
Comment 16 Andrew Johnson CLA 2020-10-18 11:49:50 EDT
I think I've now fixed it, by using org.eclipse.swt.program.Program.launch to launch the external browser.
I've only tested running Ubuntu 18.04? and Fedora under Docker on Windows.
Comment 17 Kevin Grigorenko CLA 2020-10-19 14:59:07 EDT
Thanks Andrew! I confirmed it worked as well in a snapshot build.