Skip to content

Optimization Detective not working on non-HTTPS site #1904

@swissspidy

Description

@swissspidy

Bug Description

The detection script uses crypto.subtle.digest, but the crypto API is only available in secure (HTTPS) contexts.

I noticed by accident as I was accessing my local site without HTTPS.

Then I got a JS error:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'digest')

While most sites are using HTTPS nowadays anyway, I think this potential error should be caught to avoid errors.

It can then log to the console that detection is not possible or so.

Steps to reproduce

  1. Install on HTTPS site
  2. View site
  3. See unhandled JS error

Screenshots

Additional Context

  • PHP Version:
  • OS: [e.g. iOS]
  • Browser: [e.g. chrome, safari]
  • Plugin Version: [e.g. 22]
  • Device: [e.g. iPhone6]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Status

    Done 😃

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions