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

fix: remove window and document dependencies in web packages #2689

Merged
merged 6 commits into from Dec 24, 2021

Conversation

legendecas
Copy link
Member

@legendecas legendecas commented Dec 23, 2021

Which problem is this PR solving?

Fix the dependencies on window and document API in web packages for WebWorker compatibility.

Related: #1575

Short description of the changes

  • We don't need to access web APIs from window (window === globalThis).
  • parseURL with URL constructor and fallback to anchor element if possible.
  • No longer exposes a document element in sdk-trace-web as public API.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

This should be web main frame compatible and worker tests should be introduced in #2659.

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added
  • Documentation has been updated

@legendecas legendecas requested a review from a team as a code owner December 23, 2021 04:11
@codecov
Copy link

codecov bot commented Dec 23, 2021

Codecov Report

Merging #2689 (b1b654f) into main (50252a9) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #2689   +/-   ##
=======================================
  Coverage   92.52%   92.52%           
=======================================
  Files         144      144           
  Lines        5177     5180    +3     
  Branches     1102     1103    +1     
=======================================
+ Hits         4790     4793    +3     
  Misses        387      387           
Impacted Files Coverage Δ
packages/opentelemetry-sdk-trace-web/src/utils.ts 95.00% <100.00%> (+0.09%) ⬆️
...emetry-instrumentation-xml-http-request/src/xhr.ts 97.57% <0.00%> (-0.02%) ⬇️
...s/opentelemetry-instrumentation-fetch/src/fetch.ts 97.00% <0.00%> (+0.01%) ⬆️

@vmarchaud vmarchaud added the bug Something isn't working label Dec 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants