Bug 115270 - LibreOffice Impress export *.SVG = fail. Usage of "javascript:window" in a TEXT Link results in fundamentally flawed behavior in the web browser.
Summary: LibreOffice Impress export *.SVG = fail. Usage of "javascript:window" in a TE...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
5.2.0.4 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected, filter:svg, regression
Depends on:
Blocks: Hyperlink SVG-Save
  Show dependency treegraph
 
Reported: 2018-01-28 05:02 UTC by UbunLibOffImp
Modified: 2024-03-14 07:37 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file (11.42 KB, application/vnd.oasis.opendocument.presentation)
2018-03-01 14:59 UTC, Buovjaga
Details

Note You need to log in before you can comment on or make changes to this bug.
Description UbunLibOffImp 2018-01-28 05:02:50 UTC
Description:
Environment = Ubuntu 16.04 & Firefox 58 & LibreOffice Impress Version: 5.3.7.2

In LibreOffice Impress 5.1.X.X a hyperlink (' Link ') could be assigned to text, the slide could be exported to *.SVG and the hyperlink would function properly.
Using the same code on text in Impress 5.3.7.2 and exporting the slide to *.SVG results in illogical window behavior in the web browser.
Using the same code on an image (imported *.svg file) in Impress 5.3.7.2 and exporting the slide to *.SVG results in correct window behavior in the web browser.

Here is the Link contents:

javascript:window.alert("https://google.com/");window.open("https://google.com/");window.history.go(document.baseURI);

Notice that the code above has three window objects.

The *.SVG file created by Impress instructs the web browser to open three new windows if this javascript is assigned to *TEXT*.
The *.SVG file created by Impress instructs the web browser to open one window if this javascript is assigned to an *IMAGE*.

Note that this javascript is being used since Impress cannot export a *.odp to *.svg that has relative links.
See BUG # 115236.

Here is sample HTML code that demonstrates correct behavior.
Create a *.html file and open this file in a web browser.
After clicking the button an alert box will open up on the page, followed by a new window opening up @google.com, then the first window will reset to initial state.

<!DOCTYPE html>
<html>
<body>
<p>Click the button to open a new browser window.</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {window.alert("https://google.com/");window.open("https://google.com/");window.history.go(document.baseURI);}
</script>
</body>
</html> 

Impress used to be able to create a *.SVG file that could do exactly what the HTML code listed above can do.

Steps to Reproduce:
1. Create a new *.odp
2. Type some text
3. Select some amount of text that has been typed
4. Create hyperlink out of selected text
5. Insert > Link... > Web > javascript:(use code from above)
6. Insert an image into the document to compare behavior
7. Insert > Image > pick any image
8. Select Image
9. Insert > Link... > Web > javascript:(use code from above)
10. File > Save
11. File > Export >*.svg
12. Open *.svg in a web browser and observe the incorrect behavior of the text link

Actual Results:  
Using text for a hyperlink does not result in the same behavior as when an image is used for a hyperlink. The link protocol must be javascript: since the file:// protocol fails for all situations when Impress tries to export a *.SVG.

Expected Results:
It is expected that Impress can export a *.SVG file with relative links.
Impress cannot do this.

It is expected that Impress can export a *.SVG file with javascript assigned to text.
Impress cannot do this.



Reproducible: Always


User Profile Reset: No



Additional Info:
There are *many* problems with *.SVG export from Impress. A thorough review of this functionality is needed. LibreOffice should not refer to the 5.3.7.2 release as suitable for "an enterprise or corporate environment or a conservative user".




User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0
Comment 1 Buovjaga 2018-03-01 14:59:06 UTC
Created attachment 140252 [details]
Example file

I confirm it worked in 5.0.2.2, but not in 6.1.

Version: 6.1.0.0.alpha0+ (x64)
Build ID: e1082e45361a92a31adedcc3ed0a35c704bca543
CPU threads: 4; OS: Windows 10.0; UI render: default; 
TinderBox: Win-x86_64@42, Branch:master, Time: 2018-02-15_23:24:06
Locale: fi-FI (fi_FI); Calc: group
Comment 2 Buovjaga 2018-03-01 15:07:30 UTC
How it works in 5.0:
1. click the link
2. alert pops up in the current tab
3. click the OK button
4. Google opens in a new tab

How it works in 6.1:
1. click the link
2. a new tab opens and alert pops up
3. click the OK button
4. nothing happens
5. Go to the original tab, notice an alert is in there as well
6. click the OK button
7. Google opens in a new tab
Comment 3 Buovjaga 2018-03-01 15:08:58 UTC
(In reply to Buovjaga from comment #2)
> 7. Google opens in a new tab

Addendum: if you allow pop ups from the SVG, Google will open in *two* new tabs at this point.
Comment 4 Buovjaga 2018-03-01 17:53:21 UTC
Bisected and it comes from https://cgit.freedesktop.org/libreoffice/core/commit/?id=154521777f8c551f10ffbe414891df9d2a529ae3

Adding Marco C.
Comment 5 Xisco Faulí 2018-06-05 19:45:40 UTC
Adding Cc: to Marco Cecchetti
Comment 6 QA Administrators 2020-12-16 03:57:15 UTC Comment hidden (obsolete)
Comment 7 QA Administrators 2022-12-17 03:19:23 UTC Comment hidden (obsolete)
Comment 8 Stéphane Guillou (stragu) 2023-11-09 08:23:35 UTC
Repro in:

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: ff3fb42b48c70ba5788507a6177bf0a9f3b50fdb
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded