Closed Bug 1337737 Opened 4 years ago Closed 3 years ago

No [Learn More] for HTTP header w/ a non-canonical case

Categories

(DevTools :: Netmonitor, defect, P2)

defect

Tracking

(firefox54 fixed)

RESOLVED FIXED
Firefox 54
Tracking Status
firefox54 --- fixed

People

(Reporter: teoli, Assigned: mail)

References

()

Details

Attachments

(1 file, 1 obsolete file)

Since bug 1320233, a [Learn More] link is added in the Network Panel.

The link is added only next to the whitelisted HTTP Header. The comparison with these entries seems to be case-sensitive.

A [Learn More] link is not added next to Etag (Canonical case: ETag), x-xss-protection (Canonical case: X-XSS-Protection), or x-frame-options (canonical case: X-Frame-Options).

HTTP headers are not case sensistive, so we should be more lenient.
I've added a link to https://irccloud.mozilla.com/ where these 3 specifics headers are not using the canonical case.
I can look into this. I'll have a patch ready by the end of today.
Thanks Eduardo!
Honza
Priority: -- → P2
Attached patch 1337737-v1.0.0.patch (obsolete) — Splinter Review
A day late, but here's the patch. This makes the header lookup case-insensitive.

On Try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=aa59bf25eb620d00ea4b52d1735d50ba426b2e46&selectedJob=76070868
Attachment #8835702 - Flags: review?(odvarko)
Comment on attachment 8835702 [details] [diff] [review]
1337737-v1.0.0.patch

Review of attachment 8835702 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks for the patch!

Just one inline comment

Honza

::: devtools/client/netmonitor/shared/components/headers-mdn.js
@@ +94,5 @@
> +  const lowerCaseHeader = header.toLowerCase();
> +
> +  let matchingHeaders = SUPPORTED_HEADERS.filter(supportedHeader => {
> +    return lowerCaseHeader === supportedHeader.toLowerCase();
> +  });

You don't have to iterate the entire array if you find first match so, it's better to use: Array.find()

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find

Honza
Attachment #8835702 - Flags: review?(odvarko)
Good call! Here's the updated patch.

Thanks
Attachment #8835702 - Attachment is obsolete: true
Attachment #8836382 - Flags: review?(odvarko)
Comment on attachment 8836382 [details] [diff] [review]
1337737-v1.1.0.patch

Review of attachment 8836382 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good to me!

R+ assuming try is green

Thanks for the patch!
Honza
Attachment #8836382 - Flags: review?(odvarko) → review+
Pushed by cbook@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/b29e907e4fbb
Make lookup of MDN headers case-insensitive. r=Honza
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/b29e907e4fbb
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 54
Blocks: 1339686
Assignee: nobody → mail
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.