code-charity / youtube

[top~1 open YouTube & Video web-extension] Enrich your experience & choice! 🧰180+ options & clever features📌set+forget📌Longest-standing(been tough). Please join🧩us👨‍👩‍👧‍👧 ..⋮ {playback|content discovery|player|extra buttons|distractions|related videos|shorts|ads|quality|codec|full tab|full screen}
http://improvedtube.com
Other
3.43k stars 519 forks source link

use proper messaging - Needs Safari tester #2366

Closed raszpl closed 2 months ago

raszpl commented 3 months ago

Need someone with Safari browser to test this patch. Sadly I dont even know if its possible to load unpacked extension in recent (5 years) Safari as apparently Apple removed Developer mode?!?!

raszpl commented 3 months ago

well, it is a good idea, but https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Sharing_objects_with_page_scripts means we get exception in FF (and no idea about Safari), requires cloneInto(). Ill ponder about it some more later. edit: this is enough to make Firefox happy:

    if (typeof cloneInto == 'function') {
        message = cloneInto(message, window);
    }

but this would need testing under Safari first.

ImprovedTube commented 3 months ago

hi! :)

figured why it was done like this? /any possible advantage

safari: can build with xcode and run unsigned. looking forward to have a new appstore subscription

raszpl commented 3 months ago

figured why it was done like this? /any possible advantage

DOM manipulation is slow and you need to encode stuff so it doesnt get mangled in transit, huge disadvantages. Proper messaging might look too complicated to bother, and compatibility might not have been great at the time.

Hmm Iv been trying to use events for message passing because that removes the need for json encoding (can pass raw objects inside .detail), but maybe proper way is to just use normal messaging https://developer.chrome.com/docs/extensions/develop/concepts/messaging Its compatible with all browsers. Will try that next.

safari: can build with xcode and run unsigned

I like the ease of live editing unpacked extensions. Building/packing every small change sucks :(