Observe title tag only if there actually is a player
ClosedPublic

Authored by broulik on Sep 7 2019, 12:50 PM.

Details

Test Plan

Noticed that I got title changes sent to the extension every time

  • Opened an ajax-navigating website, didnt get any title changes notified
  • Opened a player, title change observer was connected once. Player dsappeared, observer disappered
  • Verified that title change with player (e.g. spotify web player) still propagates correctly

Diff Detail

Repository
R856 Plasma Browser Integration
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
broulik created this revision.Sep 7 2019, 12:50 PM
Restricted Application added a project: Plasma. · View Herald TranscriptSep 7 2019, 12:50 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik requested review of this revision.Sep 7 2019, 12:50 PM
fvogt added inline comments.Sep 7 2019, 12:54 PM
extension/content-script.js
333

Why not document.title?

broulik added inline comments.Sep 7 2019, 12:57 PM
extension/content-script.js
333

This is to store the name and only send a change when it is different from last time I sent it. document.title will be the same as titleTag.innerText rendering this check moot

fvogt added inline comments.Sep 7 2019, 1:11 PM
extension/content-script.js
333

No, it won't be. Currently it won't send a notification if the title changes to an empty string as document.title was sent initially (line 319)

broulik added inline comments.Sep 7 2019, 1:24 PM
extension/content-script.js
333

An empty title is kinda pointless anyway, so this is on purpose

fvogt added inline comments.Sep 7 2019, 1:44 PM
extension/content-script.js
333

It would still send an empty title on initialization or changes after the first change though. So if that's the purpose of the empty string assignment, it should be done differently.

broulik updated this revision to Diff 65580.Sep 7 2019, 1:47 PM
  • init with initial value
fvogt accepted this revision.Sep 7 2019, 2:03 PM
This revision is now accepted and ready to land.Sep 7 2019, 2:03 PM
This revision was automatically updated to reflect the committed changes.