Closed Bug 1545423 Opened 5 years ago Closed 5 years ago

WebExtension API for the amount of data sent/received

Categories

(Core :: Networking: HTTP, task, P1)

task

Tracking

()

RESOLVED FIXED
mozilla72
Tracking Status
firefox72 --- fixed

People

(Reporter: dragana, Assigned: CuveeHsu)

References

Details

(Whiteboard: [necko-triaged][necko-2019q4])

Attachments

(4 files)

No description provided.
Type: defect → task
Priority: -- → P2
Whiteboard: [necko-triaged]
Summary: WebExtension API for the amount of data sent. → WebExtension API for the amount of data sent
Blocks: secure-proxy
Summary: WebExtension API for the amount of data sent → WebExtension API for the amount of data sent/received

we're not doing this at this time

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → WONTFIX

I think this is important to have, in order to know how much data we send through the proxy.
Dragana, Wennie and I had a meeting last week to discuss the importance of having such information.
I'm reopening this bug.

Status: RESOLVED → REOPENED
Resolution: WONTFIX → ---
Assignee: nobody → juhsu
Priority: P2 → P1
Whiteboard: [necko-triaged] → [necko-triaged][necko-2019q4]
  1. nsHttpTransaction::mContentLength accumulates bytes of received headers and content. (Fix: content only)
    However, nsHttpTransaction::mRequestSize is bytes sent headers and upload before header compression

Looks like nsHttpTransaction::OnTransportStatus form nsSocketTransport2/Http2Steam is more reliable for the underlying bytes sent/received.
https://searchfox.org/mozilla-central/rev/696cf3b52a9aa04aa5013008a8b448904a298356/netwerk/protocol/http/nsHttpTransaction.cpp#573

  1. localhost might be excluded in extension, since we're going to exposed (privileged only?) in details.byteWritten/byteRead of browser.webRequest.onCompleted.

(In reply to Junior [:junior] from comment #3)

  1. nsHttpTransaction::mContentLength accumulates bytes of received headers and content. (Fix: content only)
    However, nsHttpTransaction::mRequestSize is bytes sent headers and upload before header compression

Looks like nsHttpTransaction::OnTransportStatus form nsSocketTransport2/Http2Steam is more reliable for the underlying bytes sent/received.
https://searchfox.org/mozilla-central/rev/696cf3b52a9aa04aa5013008a8b448904a298356/netwerk/protocol/http/nsHttpTransaction.cpp#573

  1. localhost might be excluded in extension, since we're going to exposed (privileged only?) in details.byteWritten/byteRead of browser.webRequest.onCompleted.

We have many similar attributes:
nsIHttpChannel::transferSize: size consumed by the response header fields and the response payload body
which is from nsHttpTransaction::mTransferSize.
The name is transfer but it's about the received response. (In other words, the size which resource transfers to the client)
Note that the header is after decompressed in H2, so the number will be larger than the real bytes through the wire.

transferSize is used for ResourceTiming. (also some rcwn telemetry)
https://www.w3.org/TR/resource-timing-2/#dom-performanceresourcetiming-transfersize

It doesn't explicitly say it should or should not take HPACK into account.
It does mention the H2 overhead, but header compression isn't overhead IMO.
So I'm not sure if I should overwrite mTransferSize by use the size of compressed header.

We also have nsIHttpChannel::decodedBodySize which is about the content compression. Out of topic.
nsHttpTransaction::mContentLength is about the response body only, indicated by response header.

To conclude, instead of bike-shedding too much at the moment, I'd like to use nsHttpTransaction::mTransferSize and nsHttpTransaction::mRequestSize for the first version.

Depends on D50404

We might need to disable android since extension process. Let's see.
https://treeherder.mozilla.org/#/jobs?repo=try&revision=ed0208c01a8270cd4cec0bcd7ecfa2a44f977049

Philip, seems like this api addition is reasonable to make public. See D50405.

Flags: needinfo?(philipp)

This sounds like a good addition, let's add it to the public API.

Flags: needinfo?(philipp)
Pushed by juhsu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9f7f0e4c65da
P1 Expose requestSize to nsIHttpChannel r=dragana
https://hg.mozilla.org/integration/autoland/rev/3ae45f3be2e1
P2 web request data API implementation r=mixedpuppy
https://hg.mozilla.org/integration/autoland/rev/35758baf44e3
P3 test for new attributes in browser.webRequest.onCompleted r=baku,mixedpuppy
https://hg.mozilla.org/integration/autoland/rev/0abbf10b68b0
P4 remove privileged restriction r=mixedpuppy

Looks like conflict with test just landed today :(

Flags: needinfo?(juhsu)
Pushed by juhsu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/74229ac0f43d
P1 Expose requestSize to nsIHttpChannel r=dragana
https://hg.mozilla.org/integration/autoland/rev/1f11b971420d
P2 web request data API implementation r=mixedpuppy
https://hg.mozilla.org/integration/autoland/rev/f6b678baa610
P3 test for new attributes in browser.webRequest.onCompleted r=baku,mixedpuppy
https://hg.mozilla.org/integration/autoland/rev/a0c27d107be7
P4 remove privileged restriction r=mixedpuppy
See Also: → 1815533
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: