Skip to content

Conversation

arkamar
Copy link
Contributor

@arkamar arkamar commented Mar 15, 2023

This fixes an issue I have encountered recently in Github webpage in my web browser, where clipboard is not defined in navigator. I believe its presence should be checked before touching its items in similar fashion like other isSupported methods do. This PR is related to #18.

@arkamar arkamar requested a review from a team as a code owner March 15, 2023 16:42
@arkamar arkamar requested a review from theinterned March 15, 2023 16:42
keithamus
keithamus previously approved these changes Mar 15, 2023
Copy link
Contributor

@keithamus keithamus left a comment

Choose a reason for hiding this comment

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

Thanks for catching this!

@arkamar
Copy link
Contributor Author

arkamar commented Mar 15, 2023

Btw, following error is rapidly popping up (thousands within seconds) in current github webpage:

[Error] Unhandled Promise Rejection: TypeError: undefined is not an object (evaluating 'navigator.clipboard.read')
	K (vendors-node_modules_stacktrace-parser_dist_stack-trace-parser_esm_js-node_modules_github_bro-327bbf-0aaeb22dd2a5.js:1:8117)
	every
	(anonymous function) (environment-e059fd03252f.js:1:5328)
	m (environment-e059fd03252f.js:1:5291)
	(anonymous function) (environment-e059fd03252f.js:1:4196)
	(anonymous function)

It wasn't hard to catch :) It was way harder to find this repo :)

@keithamus
Copy link
Contributor

We'll also need to guard against this in the other methods- isPolyfilled and apply should check navigator.clipboard exists.

@arkamar
Copy link
Contributor Author

arkamar commented Mar 15, 2023

Ah, I see, I didn't realize that when I was comparing it with src/promise-any.ts. I'll work on it.

@arkamar arkamar marked this pull request as draft March 15, 2023 17:25
@arkamar arkamar marked this pull request as ready for review March 15, 2023 17:28
@arkamar
Copy link
Contributor Author

arkamar commented Mar 15, 2023

I addressed it somehow...

keithamus
keithamus previously approved these changes Mar 15, 2023
theinterned
theinterned previously approved these changes Mar 16, 2023
@theinterned theinterned dismissed stale reviews from keithamus and themself via fdd5461 March 16, 2023 17:52
@theinterned theinterned merged commit ea995cc into github:main Mar 16, 2023
@arkamar arkamar deleted the navigator branch March 16, 2023 21:05
@dylex
Copy link

dylex commented Mar 17, 2023

Glad to see this is fixed -- just tracked it down myself. I think this is what's causing github to be slow and have very high CPU use whenever it's open. Any idea when it's getting into production?

@arkamar
Copy link
Contributor Author

arkamar commented Mar 19, 2023

@dylex yes, this exactly what I am experiencing, very high CPU use, lots of exceptions.

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

Successfully merging this pull request may close these issues.

4 participants