D21927: Use window.postMessage instead of creating a wrapper item
This revision was automatically updated to reflect the committed changes. Closed by commit R856:b1ea6f2de39a: Use window.postMessage instead of creating a wrapper item (authored by broulik). REPOSITORY R856 Plasma Browser Integration CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D21927?vs=60186&id=60988 REVISION DETAIL https://phabricator.kde.org/D21927 AFFECTED FILES extension/content-script.js To: broulik, #plasma, davidedmundson, fvogt Cc: plasma-devel, LeGast00n, jraleigh, fbampaloukas, GB_2, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D21927: Use window.postMessage instead of creating a wrapper item
broulik updated this revision to Diff 60186. broulik edited the summary of this revision. broulik added a comment. - Cleanup REPOSITORY R856 Plasma Browser Integration CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D21927?vs=60121&id=60186 REVISION DETAIL https://phabricator.kde.org/D21927 AFFECTED FILES extension/content-script.js To: broulik, #plasma, davidedmundson, fvogt Cc: plasma-devel, LeGast00n, jraleigh, fbampaloukas, GB_2, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D21927: Use window.postMessage instead of creating a wrapper item
fvogt requested changes to this revision. fvogt added a comment. This revision now requires changes to proceed. > Also do some more sanity checks on the input data. Are those even necessary at that point? Considering that the referenced payload properties can still be literally anything and now even direct objects instead of just stuff converted to JSON and back. INLINE COMMENTS > content-script.js:640 > +case "playbackState": > + > +if (!["none", "paused", "playing"].includes(payload)) { Whitespace > broulik wrote in content-script.js:642 > Oops :) Yeah, let's keep it "family friendly" ;-) > content-script.js:661 > +case "callbacks": > + > +if (Array.isArray(payload)) { Whitespace REPOSITORY R856 Plasma Browser Integration REVISION DETAIL https://phabricator.kde.org/D21927 To: broulik, #plasma, davidedmundson, fvogt Cc: plasma-devel, LeGast00n, jraleigh, fbampaloukas, GB_2, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D21927: Use window.postMessage instead of creating a wrapper item
broulik added inline comments. INLINE COMMENTS > content-script.js:642 > +if (!["none", "paused", "playing"].includes(payload)) { > +console.log("shit playback state", payload); > +return; Oops :) REPOSITORY R856 Plasma Browser Integration REVISION DETAIL https://phabricator.kde.org/D21927 To: broulik, #plasma, davidedmundson, fvogt Cc: plasma-devel, LeGast00n, jraleigh, fbampaloukas, GB_2, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D21927: Use window.postMessage instead of creating a wrapper item
broulik created this revision. broulik added reviewers: Plasma, davidedmundson, fvogt. Herald added a project: Plasma. Herald added a subscriber: plasma-devel. broulik requested review of this revision. REVISION SUMMARY This should make it less invasive by not messing with the website DOM. Also do some more sanity checks on the input data. TEST PLAN Still get album art, artist info, and callbacks on both Chrome and Firefox REPOSITORY R856 Plasma Browser Integration REVISION DETAIL https://phabricator.kde.org/D21927 AFFECTED FILES extension/content-script.js To: broulik, #plasma, davidedmundson, fvogt Cc: plasma-devel, LeGast00n, jraleigh, fbampaloukas, GB_2, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart