Opened 3 years ago

Closed 3 years ago

#19193 closed defect (fixed)

AudioContext, HTMLMediaElement, and MediaStream provide currentTime to content scripts

Reported by: arthuredelstein Owned by: tbb-team
Priority: Medium Milestone:
Component: Applications/Tor Browser Version:
Severity: Normal Keywords: TorBrowserTeam201606R
Cc: mcs, brade Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description (last modified by arthuredelstein)

The worst offender is probably AudioContext, where you can get
the current time thus:

var audioContext = new AudioContext();
audioContext.currentTime;

Similarly, HTMLVideoElement.currentTime, HTMLAudioElement.currentTime, and CanvasCaptureMediaStream.currentTime can each be used as a time source with resolution better than 10 ms.

Child Tickets

Change History (9)

comment:1 Changed 3 years ago by arthuredelstein

Description: modified (diff)
Keywords: TorBrowserTeam201605R added; TorBrowserTeam201605 removed
Status: newneeds_review

Here is a branch with two patches.

https://github.com/arthuredelstein/tor-browser/commits/19193

b91f47cce42a2e048f970a18710f9c15672a6cfc is a fixup for our #1517 patch that rounds the values returned by the currentTime attributes mentioned above.

936cadcc8dd2b0e6784be69cabe44880e36839b0 provides regression tests for all time sources we are rounding in the old and new patches.

comment:2 Changed 3 years ago by gk

Cc: mcs brade added

Looks good to me.

comment:3 Changed 3 years ago by gk

Keywords: TorBrowserTeam201606 added

Moving reviews to June

comment:4 Changed 3 years ago by gk

Keywords: TorBrowserTeam201606R added; TorBrowserTeam201605R removed

comment:5 Changed 3 years ago by gk

Keywords: TorBrowserTeam201606 removed

comment:6 Changed 3 years ago by mcs

For the regression test patch (936cadcc8dd2b0e6784be69cabe44880e36839b0), the test code references silence.ogg but the patch adds a file named audio.ogg. Shouldn't they match?

The currentTime rounding patch (b91f47cce42a2e048f970a18710f9c15672a6cfc) looks good.

I tried to run the regression tests myself, but mach mochitest is not cooperating at the moment (I think this is due to Mac OS 10.11 Python differences; it is definitely not related to the tests themselves).

comment:7 in reply to:  6 ; Changed 3 years ago by mcs

Replying to mcs:

I tried to run the regression tests myself, but mach mochitest is not cooperating at the moment (I think this is due to Mac OS 10.11 Python differences; it is definitely not related to the tests themselves).

OK, I was able to run tbb-tests/test_tor_bug1517.html on a different system and it worked correctly. I guess the test does not care about the silence.ogg vs. audio.ogg difference (but it should probably be fixed).

comment:8 in reply to:  7 Changed 3 years ago by arthuredelstein

Replying to mcs:

Replying to mcs:

I tried to run the regression tests myself, but mach mochitest is not cooperating at the moment (I think this is due to Mac OS 10.11 Python differences; it is definitely not related to the tests themselves).

OK, I was able to run tbb-tests/test_tor_bug1517.html on a different system and it worked correctly. I guess the test does not care about the silence.ogg vs. audio.ogg difference (but it should probably be fixed).

Thanks for catching that mistake. I've corrected it here:

https://github.com/arthuredelstein/tor-browser/commits/19193+1

comment:9 Changed 3 years ago by gk

Resolution: fixed
Status: needs_reviewclosed

Fixed on tor-browser-45.2.0esr-6.5-1 with commit 49d0c6389eea055e94a8fb492bd95de56b9111a4 and b60b8871fa08feaaca24bcf6dff43df0cd1c5f29, thanks.

Note: See TracTickets for help on using tickets.