I seem to recall a list of "mergeable" headers somewhere in the platform code that does the merging. We could consider using that same list in the webrequest code to determine what is mergeable ahead of time, doing something similar to attachment 9112692 [details] [diff] [review] but checking against the list. Specifically, we'd need to take into account this logic: https://searchfox.org/mozilla-central/rev/7e92a667e3829831c31e8d46aefe7ef67ad5be1c/netwerk/protocol/http/nsHttpHeaderArray.cpp#68-81 And the singleton headers where appropriate: https://searchfox.org/mozilla-central/rev/7e92a667e3829831c31e8d46aefe7ef67ad5be1c/netwerk/protocol/http/nsHttpHeaderArray.h#210 There is also this bit here that handles how a header is merged: https://searchfox.org/mozilla-central/rev/7e92a667e3829831c31e8d46aefe7ef67ad5be1c/netwerk/protocol/http/nsHttpHeaderArray.h#244-253 I'm not convinced about the allowdelete patch at all, but haven't fully thought that through either.
Bug 1462989 Comment 54 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
I seem to recall a list of "mergeable" headers somewhere in the platform code that does the merging (edit: see singleton code listed below). We could consider using that same list in the webrequest code to determine what is mergeable ahead of time, doing something similar to attachment 9112692 [details] [diff] [review] but checking against the list. Specifically, we'd need to take into account this logic: https://searchfox.org/mozilla-central/rev/7e92a667e3829831c31e8d46aefe7ef67ad5be1c/netwerk/protocol/http/nsHttpHeaderArray.cpp#68-81 And the singleton headers where appropriate: https://searchfox.org/mozilla-central/rev/7e92a667e3829831c31e8d46aefe7ef67ad5be1c/netwerk/protocol/http/nsHttpHeaderArray.h#210 There is also this bit here that handles how a header is merged: https://searchfox.org/mozilla-central/rev/7e92a667e3829831c31e8d46aefe7ef67ad5be1c/netwerk/protocol/http/nsHttpHeaderArray.h#244-253 I'm not convinced about the allowdelete patch at all, but haven't fully thought that through either.