Skip to content

TypeError in JS script that parses favourite icons #1880

@websavva

Description

@websavva

Checklist

  • I am reporting an issue in existing functionality that does not work as intended
  • I've searched for existing GitHub issues

Description

There is TypeError in JavaScript code that is responsible for parsing favourite icons (favicons). Practically, method getAttribute returns null if an element doesn't have the requested attribute, according to the MDN documentation.
One of such cases is the usage of link in microdata. In particular, such links might have only two attributes
href and itemprop, according to the Schema.org. Hence, the presence of such links leads to TypeError in JavaScript and breaks the execution of scripts. The message of the error is "null is not an object (evaluating 'nodeList[i].getAttribute('rel').startsWith')"

Expected Behavior

JS script should not throw any TypeErrors if a link element doesn't have rel attribute

Actual Behavior

JS script should take into account link elements that don't have rel attribute.

Steps to Reproduce

  1. Open the url of page that contains links with no rel attribute
  2. Check logs in console

Screenshots and Videos

Image

Environment

Device: iPhone 12

iOS version: 17.5

App version: 12.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions