Closed Bug 1903266 Opened 5 months ago Closed 4 months ago

Copied URL from loading new tab does not include https:// scheme

Categories

(Firefox :: Address Bar, defect, P2)

defect

Tracking

()

VERIFIED FIXED
130 Branch
Tracking Status
firefox130 --- verified

People

(Reporter: maltejur, Assigned: mak)

References

(Blocks 1 open bug)

Details

(Whiteboard: [sng])

Attachments

(2 files, 1 obsolete file)

To reproduce:

  1. Open https://httpstat.us/200?sleep=5000 in a new tab
  2. While the page is loading, copy the URL from the loading tab

Expected result: The clipboard contains https://httpstat.us/200?sleep=5000
Actual result: The clipboard contains httpstat.us/200?sleep=5000

I cannt reproduce this, if I click on the url and ctrl+C.
Did you reproduce in Nightly?
How do you focus the urlbar and copy?

Flags: needinfo?(mjurgens)

I can reproduce this in a fresh profile in the 2024-06-17 Nightly build, I have attached a screen recording of this happening. I have tried the following methods to copy the URL and always get the same URL without a scheme:

  • Click in the address bar, then Ctrl+C
  • Click in the address bar, then right click and copy through the context menu
  • Right click the address bar directly and copy through the context menu
Flags: needinfo?(mjurgens)

We are trimming the pasted string? What do you see if you paste into an external app?

Flags: needinfo?(mjurgens)

No, that does not seem to be the issue. I also get the same trimmed string when I paste the clipboard into a different program.

Flags: needinfo?(mjurgens)
Severity: -- → S3
Priority: -- → P2
Whiteboard: [sng]
Assignee: nobody → mak
Status: NEW → ASSIGNED

When switching the tab we call setURI, pageproxystate is invalid yet, as we're still loading the page, thus no locationchange was received.
setURI sets .valueIsTyped = true, then _getSelectedValueForClipboard thinks there's a typed string and just copies the selection.
I'm not sure what's the point of setting valueIsTyped to true in setURI, I'll investigate that (it's apparently from https://bugzilla.mozilla.org/show_bug.cgi?id=668019).

Blocks: 1908360

The valueIsTyped property was introduced mostly to modify the copy behavior,
though it's misleading since it's also used by setURI, and it's not taking
into account other cases where the url is trimmed.
This removes it in favor of using the more precise userTypedValue and
_protocolIsTrimmed.
This is properly passing the untrimmedUrl value in the autofill case, also
renaming untrimmedValue to untrimmedUrl as the only case where it makes
sense to pass it is when it's a URL.

Comment on attachment 9413256 [details]
WIP: Bug 1903266 - Stop relying on valuesIsTyped to decide what to copy from the address bar.

Revision D216810 was moved to bug 1908360. Setting attachment 9413256 [details] to obsolete.

Attachment #9413256 - Attachment is obsolete: true
Pushed by mak77@bonardo.net: https://hg.mozilla.org/integration/autoland/rev/81ecd132f082 Copied URL from loading new tab does not include scheme. r=jteow,urlbar-reviewers
Status: ASSIGNED → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 130 Branch

Reproducible on a 2024-06-18 on a Nightly build on Windows 10.
Verified as fixed on Firefox Nightly 130.a1 on Windows 10, Ubuntu 22, macOS 14.

Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: