Bug 101629 - Firefox themes dialog doesnt handle invalid urls and search strings
Summary: Firefox themes dialog doesnt handle invalid urls and search strings
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
5.3.0.0.alpha0+
Hardware: x86-64 (AMD64) Linux (All)
: medium minor
Assignee: Muhammet Kara
URL:
Whiteboard: target:6.2.0
Keywords:
Depends on:
Blocks: Firefox-Themes
  Show dependency treegraph
 
Reported: 2016-08-21 00:06 UTC by loser
Modified: 2019-02-16 09:51 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
bt with symbols (15.94 KB, text/plain)
2016-08-21 08:09 UTC, Julien Nabet
Details
bt with symbols for ../en-US/ (4.74 KB, text/plain)
2016-08-21 08:29 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description loser 2016-08-21 00:06:03 UTC
If I put in Search Term or Firefox Theme URL: https://addons.mozilla.org/ LO will crash.
Same if I add ../en-US/

Note:
I had a problem with firebird during build process so I had to install on my system libtommath-1.0-1 to build it separately.
Comment 1 Julien Nabet 2016-08-21 08:04:56 UTC
On pc Debian x86-64 with master sources updated yesterday, I could reproduce this.

I don't reproduce this with LO Debian package 5.2.0.2
=> regression
Comment 2 Julien Nabet 2016-08-21 08:09:05 UTC
Created attachment 126928 [details]
bt with symbols
Comment 4 Julien Nabet 2016-08-21 08:29:37 UTC
Created attachment 126929 [details]
bt with symbols for ../en-US/

Here's another bt completely different with the other url.
Comment 5 Commit Notification 2016-08-21 10:52:23 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=454e1ebcfc589ce82c8c2d5585e22bea1ea5fc79

tdf#101629: fix https://addons.mozilla.org/ case

It will be available in 5.3.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 loser 2016-08-24 21:14:07 UTC
(In reply to Commit Notification from comment #5)
> Julien Nabet committed a patch related to this issue.
> It has been pushed to "master":
> 
> http://cgit.freedesktop.org/libreoffice/core/commit/
> ?id=454e1ebcfc589ce82c8c2d5585e22bea1ea5fc79
> 
> tdf#101629: fix https://addons.mozilla.org/ case
> 
> It will be available in 5.3.0.
> 
> The patch should be included in the daily builds available at
> http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
> information about daily builds can be found at:
> http://wiki.documentfoundation.org/Testing_Daily_Builds
> 
> Affected users are encouraged to test the fix and report feedback.

I ran git pull -r and then make again.
If I test again  https://addons.mozilla.org/ it works now. I can see themes. Same if I put a tag like Abstract etc...it works fine. Thank you.

If you try however https://addons.mozilla.org/en-US/ well the result is weird:
"Cannot open https://services.addons.mozilla.org/en-US/firefox/api/1.5/search/https://addons.mozilla.org/en-US//9/15, pleae try again alter.". No crash.
I think nobody will care but I am reporting this for info.
Comment 7 Yousuf Philips (jay) (retired) 2016-09-01 11:31:21 UTC
@Julien: unfortunately the fix was the right thing to do. It should have checked if it is a url and if it is an invalid theme url, it should stop the search and show an error message dialog, as the current fix will search the themes for that invalid url, as can be seen in comment 6.
Comment 8 Julien Nabet 2016-09-01 12:38:08 UTC
(In reply to Yousuf Philips (jay) from comment #7)
> @Julien: unfortunately the fix was the right thing to do. It should have
> checked if it is a url and if it is an invalid theme url, it should stop the
> search and show an error message dialog, as the current fix will search the
> themes for that invalid url, as can be seen in comment 6.

I suppose you meant, "wasn't the right thing to do". In this case, I'll revert it ASAP.
Comment 9 Yousuf Philips (jay) (retired) 2016-09-01 15:09:44 UTC
(In reply to Julien Nabet from comment #8)
> I suppose you meant, "wasn't the right thing to do". In this case, I'll
> revert it ASAP.

Yes forgot the not part :D. If you could improve on your patch that would be fine, else revert.
Comment 10 Julien Nabet 2016-09-01 19:50:15 UTC
(In reply to Yousuf Philips (jay) from comment #9)
> (In reply to Julien Nabet from comment #8)
> > I suppose you meant, "wasn't the right thing to do". In this case, I'll
> > revert it ASAP.
> 
> Yes forgot the not part :D. If you could improve on your patch that would be
> fine, else revert.

Here's the revert commit for review:
https://gerrit.libreoffice.org/#/c/28605/
Comment 11 Commit Notification 2016-09-02 05:11:29 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=a8a7b7114d96b2013b00e9bc0ced81aad5495457

Revert "tdf#101629: fix https://addons.mozilla.org/ case"

It will be available in 5.3.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 12 Julien Nabet 2016-09-02 05:12:13 UTC
The patch is reverted now.
Comment 13 Yousuf Philips (jay) (retired) 2016-09-02 19:59:01 UTC
The fixed should be something like this

if ( searchTerm.startsWith( "https://" ) OR searchTerm.startsWith( "http://" ) ) {
   if ( searchTerm.startsWith( "https://addons.mozilla.org/en-US/firefox/addon/" ) {
      { download and install searchTerm theme }
   } else {
      { show error message and return to dialog }
   }
} else {
   { strip away unnecessary characters from searchTerm and then query }
}
Comment 14 Xisco Faulí 2017-09-29 08:53:30 UTC Comment hidden (obsolete)
Comment 15 Daniele 2018-03-19 00:10:49 UTC
Tried to install Firefox theme with the following url https://addons.mozilla.org/en-US/firefox/addon/brushed-like-chrome/?src=rating and it keeps crashing. LO 5.4.5 on Mac Osx 10.13.3 High Sierra
Comment 16 Julien Nabet 2018-03-19 22:10:43 UTC
I submitted a new patch for review here:
https://gerrit.libreoffice.org/#/c/51607/

I tried to apply https://bugs.documentfoundation.org/show_bug.cgi?id=101629#c13 except I don't know which unecessary characters to remove.

Also what about this url: https://services.addons.mozilla.org/en-US/firefox/api/1.5/search/
?
Comment 17 Commit Notification 2018-10-09 17:42:09 UTC
Muhammet Kara committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e59ea346d31d416e61b963648e78c5c7f13d8551

tdf#101629: Handle invalid urls and search strings for Personas

It will be available in 6.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 18 stevejb33 2019-02-16 01:26:09 UTC
I've had been looking forward to the this fix and I installed 6.2.0 on my Windows 10 Pro 64bit OS version 1809.  I would like to say the good news is that it looks like it now handles invalid urls and doesn't crash, however I thought this fix would more crucially deal with handling valid URL's, which I tested first, maybe this was overlooked?  because if you do a search for firefox themes in AskLibreOffice there are several questions/issues relating to this problem going back to Sept 2015 and the problem was NOT really that LO didn't handle invalid URL's,so much, who really cares about that, except that you don't want it to crash? what is way more important than that is that LO handles VALID URL's, allowing users to actually view and load the Firefox themes, which if you look at all those posts on AskLibreOffice you will see that there is more of a problem with valid URL's since the problem has been reported and practically spelt out many times and those posts have been viewed hundreds of times, so lots of users interested, including myself for whom its extremely important to be able to choose a darker theme to preserve my ever decreasing eyesight, which has been depleted by having to look at insanely bright white backgrounds for far too long including the one I am typing in now :( but after this fix I installed LO 6.2.0 and I entered the actual URL of the location where firefox themes are located namely:

https://addons.mozilla.org/en-US/firefox/themes/

and I get the error

"Error
"Please enter a valid theme address"

This functionality is unclear anyway and needs clarification of how its intended to work? 
Intuitively though from looking at this dialog, you would expect to simply enter the URL to the firefox themes as above,  since under the url field there is a drop-down containing all of the Firefox theme sub-categories as per the website, so you wouldn't really expect that you would need to provide a specific theme's URL would you? well yes being a tester, you try everything and leave no stone unturned and users are testers of a kind, like I tried a precise url to a single theme as follows:

https://addons.mozilla.org/en-US/firefox/addon/matte-black-v2/?src=hotness

This crashed LO Writer and it reported:

Due to an unexpected error LO crashed...

Does anyone actually test these bugfixes before they are released?  If this is to be implemented and fixed properly then the fix needs to consider and fully test, both valid and invalid URL's and LO really need to review how this is implemented!  In my humble opinion, when I open this dialog and choose "Own Theme" the url to the firefox themes (https://addons.mozilla.org/en-US/firefox/themes/) should be embedded with this URL as the default, LO should not expect the end user to provide the URL, that is unless for some reason Mozilla have changed the URL and you need to modify it then that would make sense.

The only consolation for LO users waiting on this fix is you can now also choose and apply any of the LO presets :)
Comment 19 Julien Nabet 2019-02-16 09:51:28 UTC
(In reply to stevejb33 from comment #18)
>...
LO isn't responsible about Mozilla's changes.
See https://bugs.documentfoundation.org/show_bug.cgi?id=123228