Skip to content

Fix debug calls while in a preload script inside Electron #377

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

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ function useColors() {

// is webkit? http://stackoverflow.com/a/16459606/376773
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
return (typeof document !== 'undefined' && 'WebkitAppearance' in document.documentElement.style) ||
// document.documentElement is null in Electron preload scripts
return (typeof document !== 'undefined' && document.documentElement &&
'WebkitAppearance' in document.documentElement.style) ||
Copy link
Contributor

Choose a reason for hiding this comment

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

wondering if you meant to add an && to the end of the null pointer check document.documentElement? This looks like a syntax error

Copy link
Author

Choose a reason for hiding this comment

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

Idek where that && went, let's pretend this didn't happen and move on 😆

// is firebug? http://stackoverflow.com/a/398120/376773
(typeof window !== 'undefined' && window.console && (console.firebug || (console.exception && console.table))) ||
// is firefox >= v31?
Expand Down