Closed Bug 2025163 Opened 3 months ago Closed 6 days ago

Crash when pasting really long URLs

Categories

(Firefox for Android :: Toolbar, defect)

Firefox 148
All
Android
defect

Tracking

()

RESOLVED FIXED
154 Branch
Tracking Status
firefox154 --- fixed

People

(Reporter: gcda, Assigned: petru)

References

Details

(Whiteboard: [fxdroid][group3])

Attachments

(2 files)

Attached file bad piggies.txt

User Agent: Mozilla/5.0 (Android 16; Mobile; rv:148.0) Gecko/148.0 Firefox/148.0

Steps to reproduce:

strudel.cc is a web version of tidalcycles, a way to make music with code.

When you share a song you made, it is encoded into a really long URL (the # part, I think it's called the URL fragment?). I remade the entirety of the bad piggies theme, but when I paste the shared link in the address bar the app crashes.

I provided the link as an attachment.

Actual results:

"Firefox keeps stopping" and immediately closes after pasting.

Expected results:

  1. (Preferred) The link is handled normally, as with Firefox desktop. Maybe with a warning pop-up explaining that the link is enormous and to double check if you actually want to open it.
  2. The user is notified that the link is too long and cannot be opened
  3. (Not preferred) Same behaviour as Ungoogled Chromium (the link is cut short without any user notification)
Severity: -- → S2

I'm able to reproduce this on my Pixel 8. Assigning this the S2 severity since there are no workarounds

The Bugbug bot thinks this bug should belong to the 'Firefox for Android::Toolbar' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: General → Toolbar
Whiteboard: [fxdroid][group3]
Assignee: nobody → petru
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

@gcda @Gela Can you still reproduce the issue?
I see the URL from the description having 20k characters. Trying to paste even a 100k characters URL doesn't crash the application for me but does cause some UX degradation, I'll look into avoiding this.

Flags: needinfo?(gmalekpour)
Flags: needinfo?(gcda)

Testing it more I think the original issue was fixed by us clipping the pasted text in bug 2006921 for v.147.
Not sure for which Firefox version was this ticket opened.

The UX degradation that I see now when editing very long URLs seems to be a Compose issue - https://issuetracker.google.com/issues/527276313 - it just can't show more than ~10k characters.

I just tested this on my local dev build and it no longer reproduces on the same device as before. I actually am not even really noticing any UI issues but that is maybe more device dependent.

Flags: needinfo?(gmalekpour)

(In reply to Petru-Mugurel Lingurar [:petru] from comment #3)

@gcda @Gela Can you still reproduce the issue?
I see the URL from the description having 20k characters. Trying to paste even a 100k characters URL doesn't crash the application for me but does cause some UX degradation, I'll look into avoiding this.

Note: I'm from a different phone because the Pixel broke. It's a OnePlus Nord N100 with a custom ROM with MicroG instead of GApps.
Firefox is installed from F-Droid. If you need tests done with a more "commercial" device just ask!

Firefox info:
151.0 (Build #2016160826), fdf733c8d234ef2a5a7deee5b3285f87fa32b1d8
GV: 151.0-20260513195118
AS: 151.0.2
OS: Android 14

Now I can manage to open the links! But it's still finnicky and requires a bit of dark magic. It only works the first time.

When opening a new tab and pasting the links the address bar cannot render text, but it renders the selection overlay. It's like as if I filled the whole address bar with spaces and selected everything. If I press enter on the phone's keyboard the link works just fine.

If I try to tap the address bar and move the cursor around I get only a "/" and If I wiggle it hard enough I can go to the base url "https://strudel.cc/" but nothing beyond it renders or is selectable.

Trying then to move the cursor to the rightmost part of the visible url often crashes the application. If it doesn't crash, wiggle it around a bit and try again.

While on the page, trying to tap the address bar, clicking the little x on the right and pasting the link again clips the link. I get about ~17 lines in strudel, the length seems always the same.

Long pressing the URL bar and pressing paste from there gets the same behaviour of the new tab but pressing enter doesn't navigate to the new page.

Visiting a shorter link (such as github.com) and then trying again has the same behaviour as the new tab.

Great work! Thank you for spending time on this

Flags: needinfo?(gcda)

Thanks @gcda!
Seems like what you're describing aligns also with what I saw and shows the platform limitation - an url/text longer than ~10k characters cannot be rendered as an editable in Jetpack Compose - for which I've opened a ticket @Google here.
I will look into possible alternatives for this.

Pasting long URLs will have them clipped to a shorter length to avoid other issues (crashes) similar to the above.
To overcome and still being able to load a long URL one can click on a link to be directly opened in Firefox.

(In reply to Petru-Mugurel Lingurar [:petru] from comment #7)

Thanks @gcda!
Seems like what you're describing aligns also with what I saw and shows the platform limitation - an url/text longer than ~10k characters cannot be rendered as an editable in Jetpack Compose - for which I've opened a ticket @Google here.
I will look into possible alternatives for this.

Pasting long URLs will have them clipped to a shorter length to avoid other issues (crashes) similar to the above.
To overcome and still being able to load a long URL one can click on a link to be directly opened in Firefox.

Happy to help!

Since the limitation seems to be in the address bar widget instead of the engine itself, would a workaround like showing a popup if you try to insert an url longer than 10k characters be possible? Or at least a toast notification that notifies that the URL is too long? I think the way that Chromium handles things is very user unfriendly.

Hope you don't mind the question :)

(In reply to gcda from comment #8)

Happy to help!

Since the limitation seems to be in the address bar widget instead of the engine itself, would a workaround like showing a popup if you try to insert an url longer than 10k characters be possible? Or at least a toast notification that notifies that the URL is too long? I think the way that Chromium handles things is very user unfriendly.

Hope you don't mind the question :)

Thank you for this!
Good point about being explicit when we are trimming the URL.
We were already doing this for the old toolbar without a message.
Will check within the team if we should show a message about it and what the content should be.

But for now the direction to avoid this kind of issues seems to be:

  • trimming the URL to at max 25k characters (same as for the old toolbar) which should avoid the crash you saw when editing the URL and also with this upstream one - bug 2051295. The engine does load bigger URLs but showing/editing them is problematic.
  • showing the URL on multi lines if having more than 10k characters - when being edited - to ensure it is rendered entirely as a temporary workaround for this other upstream bug.
Pushed by plingurar@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/d1d471927cc9 https://hg.mozilla.org/integration/autoland/rev/8fdbd6e94d1e Show the toolbar's URL as multiline when edited if bigger than 10k characters r=android-reviewers,moyin
Status: ASSIGNED → RESOLVED
Closed: 6 days ago
Resolution: --- → FIXED
Target Milestone: --- → 154 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: