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

Support navigator.doNotTrack #1861

Merged
merged 6 commits into from
Mar 21, 2018
Merged

Support navigator.doNotTrack #1861

merged 6 commits into from
Mar 21, 2018

Conversation

ghostwords
Copy link
Member

@ghostwords ghostwords commented Feb 8, 2018

Fixes #1835, fixes #1260.

For example, see this Medium blog page with a bunch of JavaScript DNT checks.

@ghostwords ghostwords added the DNT policy EFF's Do Not Track policy: www.eff.org/dnt-policy label Feb 8, 2018
@ghostwords ghostwords force-pushed the set-dnt-on-navigator-object branch from c833a7f to b93953f Compare February 8, 2018 21:26
@ghostwords
Copy link
Member Author

ghostwords commented Feb 14, 2018

Using the "spam frames with messages every ten milliseconds until the frame responds or message limit is hit from chrome.webNavigation.onCommitted" approach (patch you can git apply to this branch) results in injection typically around 1 ms (but never at 0 ms) in Chrome and anywhere between 3 and 20 ms in Firefox using my navigator.doNotTrack test fixture.

Using our current "content script messages background page and acts upon response" approach, I see timings that are about twice as slow (8 ms vs. 16 ms in Firefox, for example).

Since both approaches are relatively fast while neither succeeds at intercepting the inline script (at "0 ms"), I see no reason to switch to the onCommitted approach.

@ghostwords
Copy link
Member Author

Using chrome.tabs.executeScript triggered from chrome.webNavigation.onCommitted (patch) results in similar timings as the "repeatedly attempt script injection by messaging the content script upon chrome.webNavigation.onCommitted" approach above.

We could otherwise end up performing assertions before the body finished
being populated (such as by an inline script).
Conflicts:
	tests/selenium/pbtest.py
@ghostwords ghostwords requested a review from bcyphers March 19, 2018 19:28
Copy link
Contributor

@bcyphers bcyphers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I haven't been able to find any bugs. The test script gist does sometimes display 'unset (navigator.doNotTrack="unspecified")' when I open it in firefox with privacy badger enabled, but this has not caused the tests to fail for me. Maybe we should change the test page's timeout from 50 to 100 ms, just to be safe?

@ghostwords ghostwords merged commit 3053e39 into master Mar 21, 2018
ghostwords added a commit that referenced this pull request Mar 21, 2018
Support navigator.doNotTrack
@ghostwords ghostwords deleted the set-dnt-on-navigator-object branch March 21, 2018 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DNT policy EFF's Do Not Track policy: www.eff.org/dnt-policy
Projects
None yet
2 participants