youtube icon indicating copy to clipboard operation
youtube copied to clipboard

use proper messaging - Needs Safari tester

Open raszpl opened this issue 1 year ago • 3 comments

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 avatar Jun 11 '24 20:06 raszpl

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.

raszpl avatar Jun 12 '24 01:06 raszpl

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

ImprovedTube avatar Jun 17 '24 03:06 ImprovedTube

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 :(

raszpl avatar Jun 17 '24 06:06 raszpl