examples icon indicating copy to clipboard operation
examples copied to clipboard

Make google_search_features.js work on pages without CSS

Open fritz-c opened this issue 7 years ago • 2 comments

When no CSS features are used at the specified URL, it exits with an error:

(node:11369) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'reduce' of undefined
    at uniqueByProperty (google_search_features.js:99:34)
    at google_search_features.js:244:22
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:118:7)

The content of the failing page was as follows:

Hi
<script type="text/javascript">
  console.log(['a', 'b'].includes('b') ? 'has b' : 'no b');
</script>

This pull request provides a default argument to one of the utility functions to prevent said reduce errors.

fritz-c avatar Mar 15 '18 05:03 fritz-c

Good catch!

ebidel avatar Mar 15 '18 06:03 ebidel

Ping.

ebidel avatar Oct 08 '18 15:10 ebidel