Closed Bug 1613276 Opened 6 years ago Closed 5 years ago

data URIs are misinterpreted as a search, if they include a question mark and a space

Categories

(Firefox :: Address Bar, defect, P3)

defect
Points:
3

Tracking

()

VERIFIED FIXED
Firefox 77
Tracking Status
firefox-esr68 --- wontfix
firefox72 --- wontfix
firefox73 --- wontfix
firefox74 --- wontfix
firefox75 --- wontfix
firefox76 --- wontfix
firefox77 --- verified

People

(Reporter: dholbert, Assigned: mak)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

STR:

  1. Type or copypaste this data URI into your location bar, and then hit enter:
data:text/html,oh hi?

(Notice the space character - it is important.)

EXPECTED RESULTS:
Firefox should show me a basic document with content oh hi?

ACTUAL RESULTS:
Firefox takes me to a google search for the search string data:text/html,oh hi?


Here's a slightly more complex data URI that's a bit clearer about why it needs spaces and a question mark (and also triggers this issue):

data:text/html,<div style="color:green">Is this green?

In Chrome and older versions of Firefox, this ^^ URI produces a basic document with some green text saying "Is this green?". In current Firefox and Firefox Nightly, it gives ACTUAL RESULTS (a google search page for the raw data URI).

mozregression gives me this range:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=f3e62cd8aef6a739ec433be0c43837fd23af2426&tochange=7a266c35cb309b3be5686b2814947092623bd36e

...which means this was a regression from:
https://hg.mozilla.org/integration/autoland/rev/7a266c35cb309b3be5686b2814947092623bd36e

Ed Lee — Bug 1541502 - Add Pocket menu, triggering improvements and bug fixes to Activity Stream r=k88hudson

Flags: needinfo?(edilee)

I don't think the regression is from that bug 1541502 newtab export. The behavior seems to be the urlbar dropdown/view switches the first result from "Visit" to "Search with Google" when there's a space and a ?.

Initial check of that export commit and the parent both exhibit the searches-in-google behavior. I'll try to bisect some more

Component: General → Address Bar
Flags: needinfo?(edilee)

(In reply to Ed Lee :Mardak from comment #1)

The behavior seems to be the urlbar dropdown/view switches the first result from "Visit" to "Search with Google" when there's a space and a ?.

Aha, you're right! If I type in an affected data URI and then hit "esc" (to close the autocomplete dropdown) before hitting enter, then I get EXPECTED RESULTS.

RE the regression cset -- you're right, the parent cset reproduces the issue as well[1]... I'm not sure what happened with my bisection. Sorry about that!

[1] based on mozregression --repo autoland --launch f3e62cd8aef6a739ec433be0c43837fd23af2426

Regressed by: 1538050
No longer regressed by: 1541502
Has Regression Range: --- → yes

(That regressing bug makes much more sense -- thanks for fixing that.)

Points: --- → 3
Priority: -- → P2

I could reproduce the issue on Windows 10 x64, Mac 10.14 and Ubuntu 18.04.3 LTS on all latest Firefox Release 72.0.2, Beta 73.0 and Nightly 74.0a1 (2020-02-06) versions. Will add the according flags.

OS: Unspecified → All
Hardware: Unspecified → All
Priority: P2 → P3
Blocks: 1180329
No longer blocks: qb-results-papercuts
Assignee: nobody → mak
Status: NEW → ASSIGNED

Ideally spaces should always be encoded when in the path, so I don't think those are valid URIs, according to the spec.
That said, it should be trivial to detect the data protocol and special case them, considered they are particularly useful for developers, and also for parity with other browsers.

Note the test case is currently affected by bug 1631611.

Ignore whitespaces when tokenizing strings looking like data: urls.
Improve the tokenizer to better distinguish possible origins from text, by
using the domains whitelist.
Fix a regexp mistake uncovered by the test.

Pushed by mak77@bonardo.net: https://hg.mozilla.org/integration/autoland/rev/25ebae846f09 Visit data: URIs containing spaces rather than searching them. r=adw
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 77

I verified this issue using Fx 77.0a1 (2020-04-30), on Windows 10 x64 and macOS 10.13.

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

Attachment

General

Created:
Updated:
Size: