Telegram-iOS icon indicating copy to clipboard operation
Telegram-iOS copied to clipboard

TypeError in JS script that parses favourite icons

Open websavva opened this issue 2 months ago • 0 comments

Checklist

  • [x] I am reporting an issue in existing functionality that does not work as intended
  • [x] 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

websavva avatar Oct 14 '25 12:10 websavva