Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible new fingerprint vector with Window.requestAnimationFrame() #2370

Closed
5 tasks done
uazo opened this issue Oct 2, 2022 · 5 comments
Closed
5 tasks done

Possible new fingerprint vector with Window.requestAnimationFrame() #2370

uazo opened this issue Oct 2, 2022 · 5 comments

Comments

@uazo
Copy link
Collaborator

uazo commented Oct 2, 2022

Preliminary checklist

  • I have read the README.
  • I have searched the existing issues for my problem. This is a new ticket, NOT a duplicate or related to another open issue.
  • I have read the FAQs.
  • I have updated Bromite to the latest version. The bug is reproducible on this latest version.
  • This is a bug report about the Bromite browser; not the website nor F-Droid nor anything else.

Can the bug be reproduced with corresponding Chromium version?

Yes

Bromite version

105.0.5195.147

Device architecture

x64

Android version

10

Device model

it does not matter

Changed flags

it does not matter

Is this bug about the SystemWebView?

No

Is this bug happening in an incognito tab?

Yes

Is this bug caused by the adblocker?

No

Is this bug a crash?

No

Describe the bug

described here bug id 1236113

Steps to reproduce the bug

repo https://github.com/matthova/web-worker-boot-time-detector

Expected behavior

I think it should at least be changed to

double time = (args.frame_time - base::TimeTicks::UnixEpoch()).InMillisecondsF();

although it would be better to use Performance::ClampTimeResolution()
I will check

EDIT: checked, no, it doesn't work out like that.

Screenshots

No response

@uazo
Copy link
Collaborator Author

uazo commented Oct 2, 2022

I think the correct way to fix it is

diff --git a/third_party/blink/renderer/core/animation_frame/worker_animation_frame_provider.cc b/third_party/blink/renderer/core/animation_frame/worker_animation_frame_provider.cc
index 9c96971a7c..9e200c8ae1 100644
--- a/third_party/blink/renderer/core/animation_frame/worker_animation_frame_provider.cc
+++ b/third_party/blink/renderer/core/animation_frame/worker_animation_frame_provider.cc
@@ -7,7 +7,9 @@
 #include "base/trace_event/trace_event.h"
 #include "third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.h"
 #include "third_party/blink/renderer/core/timing/worker_global_scope_performance.h"
+#include "third_party/blink/renderer/core/workers/worker_global_scope.h"
 #include "third_party/blink/renderer/platform/bindings/microtask.h"
+#include "third_party/blink/renderer/platform/wtf/casting.h"
 #include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"

 namespace blink {
@@ -62,7 +64,11 @@ void WorkerAnimationFrameProvider::BeginFrame(const viz::BeginFrameArgs& args) {
             }
           }

-          double time = (args.frame_time - base::TimeTicks()).InMillisecondsF();
+          auto* global_scope = DynamicTo<WorkerGlobalScope>(provider->context_.Get());
+          DCHECK(global_scope);
+          double time = Performance::ClampTimeResolution(
+                          args.frame_time - global_scope->TimeOrigin(),
+                          provider->context_->CrossOriginIsolatedCapability());
           provider->callback_collection_.ExecuteFrameCallbacks(time, time);
         }
         provider->begin_frame_provider_->FinishBeginFrame(args);

I will prepare a pull.
I also try to propose it to the chromium team

@csagan5
Copy link
Contributor

csagan5 commented Oct 19, 2022

Sounds like a nice improvement.

@uazo
Copy link
Collaborator Author

uazo commented Oct 19, 2022

yes, personally I am curious to get some feedback from the chromium team. they took charge of it.
I'll wait for their opinion, then I'll prepare the patch

@csagan5
Copy link
Contributor

csagan5 commented Oct 19, 2022

they took charge of it.

I suggest to spend some time to setup the repository to submit Chromium patches, so that you can get proper credits in future.

@csagan5
Copy link
Contributor

csagan5 commented Dec 2, 2022

Fixed in 108.0.5359.75.

@csagan5 csagan5 closed this as completed Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants