mozilla :: #min-vid

11 Jul 2017
19:01_6a68gotta grab some water, be right in vidyo after that
19:02JSON_voorheescool
19:07JSON_voorheesit's probably my connection
19:07JSON_voorheesthe internet isn't very consistent here
19:12JSON_voorhees_6a68: I'll def talk to devtools thats a great idea
19:12_6a68 if anyone has figured it out, it'd be them
19:12JSON_voorheesfor sure
19:12JSON_voorheesnot really a big deal if not tho
19:12_6a68you could ask in #teamaddons too, there might be a snippet somewhere on MDN
19:13JSON_voorheeshey I'm gunna switch to tether off my phone back in one second
19:13_6a68cool
19:14JSON_voorheesokay that's better
19:15JSON_voorheessome days this internet is totally fine, and others it's unbearable
19:15_6a68that's funny, maybe somebody running a microwave or whatever
19:15JSON_voorheesan internet of things microwave
19:16JSON_voorheesSo yeah, I'm basically going through all of those files porting stuff over, gunna keep doing that this afternoon and evening until i get it all loading right
19:16_6a68I do think I'll have l10n done today. do you want help with any of the tasks in the etherpad? or I can try the setTimeout thing noitidart suggested?
19:16_6a68awesome
19:16JSON_voorheesLet's hold off the on the noitidart thing until we get this thing ported
19:16_6a68the loader stuff in firefox is really weird. there was one bug where I unloaded Console.jsm in universal search, and that actually unloaded the file for all of firefox, so we got the weirdest bug reports for a minute
19:17JSON_voorheesthe overlayicon/pagemod stuff is what I'm mostly worried about
19:17JSON_voorheesThat makes no sense haha
19:17JSON_voorheesLooking forward to running into all types of junk like that
19:17_6a68yeah, the jsm loader is like 20 years old
19:17_6a68once I get l10n done, I'll do some research around replacing pagemod
19:18_6a68probably tomorrow
19:18JSON_voorheesawesome!
19:18_6a68I think once we get messaging figured out, which other people have done successfully, adding the icon will be really easy
19:19JSON_voorheesyeah I think your right
19:19_6a68like, once you have a script running in the content page, it's just, find selectors and add a classname
19:19JSON_voorheesJust kinda concerned about how hard its gunna be to inject code that will run in the page
19:19_6a68inject the stylesheet into the page, and done
19:19_6a68I actually found a thing that does that, one sec
19:19JSON_voorheessince security stuff might be blocking that
19:19JSON_voorheesoh awesome
19:19JSON_voorheesyeah it's really simple
19:19_6a68check line 25 of the etherpad: Services.ppmm.loadProcessScript should do it...
19:20JSON_voorheestheoretically
19:20_6a68yeah, exactly. theoretically
19:20_6a68but the webextension code all uses these same low level building blocks, so we should be able to copy their approach or ask them, if we need to
19:20JSON_voorheeswoah could it really be that simple!?
19:20JSON_voorheesamazing
19:21_6a68well, it's deceptive
19:21_6a68take a look at all the different kinds of message managers:
19:21_6a68https://developer.mozilla.org/en-US/Firefox/Multiprocess_Firefox/Message_Manager/Message_manager_overview
19:22_6a68so, like, you can easily run into bugs where you inject a script into just one window, or jsut one tab in a window, or you accidentally have just one global copy of a per-tab script
19:22_6a68but again, these building blocks are probably used by page-mod, and also by the new webextension content_scripts code, so we can cheat off their work to get it done
19:22JSON_voorhees totally
19:23_6a68maybe I can just help with minvid stuff till 2, see how much I can uncover
19:24_6a68I can look into pagemod messaging, or other stuff from that etherpad
19:24JSON_voorheespagemod is the only thing I'm worried about
19:24JSON_voorheesI'm still processing/porting all of the other stuff you helped me uncover today
19:24_6a68cool. I'll ping some addons people and try to get advice on pagemod stuff
19:25_6a68I'll update that etherpad when I get good answers
19:25JSON_voorheesperfect
19:25JSON_voorheesI'm gunna be hacking into the night tonight
19:26JSON_voorheesgunna try and get everything I can, so I have something to show tomorrow to wil and john
19:26JSON_voorheesIt's getting to dang hot in this here studio, gotta switch my location up
19:36_6a68Everyone in #teamaddons is insisting that content scripts would be the way to go, not wiring it up manually
19:39_6a68That would solve the problem of injecting code into youtube.com or whtaever to insert the overlay icon, something like content_scripts: { matches: ["*"], js: ["icon-overlay.js"] }
19:55JSON_voorheesbut then we would have to use webextensions
19:55JSON_voorheesfor only the icon=overlay?
19:56JSON_voorhees_6a68: damn I wish I had been in teamaddons to see the scrollback
19:56JSON_voorheesI guess it is logged tho
19:58JSON_voorheesis there another way to use content-scripts?
19:59JSON_voorheesnope no loggin on that channel :/
20:11_6a68so, we would just do an empty embedded webextension
20:11_6a68empty except for the pagemod scripts, and a manifest file
20:12_6a68I think that we could also put the react app inside the webextension, because at startup time, the webextension's random UUID moz-extension URL is exposed to the embedding restartless addon
20:13_6a68I can screenshot the conversation but it's not super deep, just lots of people telling me not to do manual script injection
20:16_6a68the advantage of putting the react app inside the webextension is that it's a regular html5 environment, *and* there is a postmessage port already available between the embedding and embedded addons, so that solves the chrome/content messaging problem
20:16_6a68do you have a branch I can fork to try to prototype the embedded webext?
20:16JSON_voorheesI'd like to see it
20:16_6a68cool, sec
20:16JSON_voorheesyeah I think so
20:17JSON_voorheesThis is the branch https://github.com/meandavejustice/min-vid/tree/sdk-to-webextension
20:17GitHub171[min-vid] meandavejustice pushed 1 new commit to sdk-to-webextension: https://git.io/vQDmd
20:17GitHub171min-vid/sdk-to-webextension 146216c Dave Justice: conversion to webpack etc...
20:17JSON_voorheesjust pushed latest
20:19_6a68sweet
20:20JSON_voorheesI'll message u here instead _6a68
20:20JSON_voorheesthanks for the screenshots
20:20_6a68it looks like you already have content scripts in that branch
20:20_6a68np
20:20JSON_voorheesYeah that branch was going that route
20:20_6a68so those should Just Work for inserting the icon-overlay, but be aware that the icon url will change (unless it's inlined in the css)
20:21JSON_voorheesHonestly if we are doing embedded webextension I think I have enough info to get it all working
20:21JSON_voorheeswhat do you mean it will change?
20:22_6a68the data.url('path/to/file') thing from sdk changes into something similar but different
20:23JSON_voorheesoh I understand
20:23JSON_voorheesI thought you meant it could change randomly
20:24JSON_voorheesI'm going to draw out how best to try and divide up concerns between the webextension and restartless
20:24JSON_voorheescus the webextension apis are nicer, so we mine as well go back to using as much of them as we can I guess
20:27_6a68yeah, I guess it would be nice to just use their storage API
20:27_6a68there is no preferences support in webextensions, so that stays on the bootstrapped side
20:28_6a68and I guess context menus get really really easy too
20:28_6a68although they are very limited right now
20:29_6a68there's a bug to add an event before the context menu is displayed, to let webextensions dynamically create/change menu items, I dunno when that will land, though
20:29JSON_voorheesyeah we'll probably have to use the xpcom context menu, but we can put that off for now and hope that webext support will land first
20:29JSON_voorheesand just add that last if necessary
20:30JSON_voorheesThis works out pretty good actually
20:30_6a68yeah
20:30JSON_voorheesI gotta run out for a bit, I can ping you when I'm back tho
20:30_6a68cool
20:31JSON_voorheesThanks for talking through this stuff with me _6a68
20:39_6a68for sure! I think we have a pretty clear path to migrating now
21:12GitHub60[min-vid] 6a68 opened pull request #911: sketch out bootstrap and install.rdf (sdk-to-webextension...embed-webext) https://git.io/vQDCK
21:20GitHub80[min-vid] meandavejustice pushed 1 new commit to sdk-to-webextension: https://git.io/vQDWi
21:20GitHub80min-vid/sdk-to-webextension fe52da8 Jared Hirsch: sketch out bootstrap and install.rdf (#911)
21:20GitHub182[min-vid] meandavejustice closed pull request #911: sketch out bootstrap and install.rdf (sdk-to-webextension...embed-webext) https://git.io/vQDCK
21:20JSON_voorheesthanks _6a68
21:20_6a68
21:30JSON_voorhees_6a68: So above you mentioned putting the react app inside the webextension, I'm not sure that will work for us :/
21:31_6a68why?
21:31JSON_voorheesSince we will need to load it into the window we create on the restartless side
21:31JSON_voorheesand send our messages between our window-utils code and the react app
21:31_6a68we can pass the moz-extension URL of the react app page into window.open, I think
21:32_6a68the messages can flow bettween the two using the onConnect port, using the webextension background page as a proxy between the chrome code and the react app
21:32_6a68I *think* it will work
21:32_6a68gotta run for now, can reply more async :-)
21:33JSON_voorheesOkay, I'll try an explain
21:35JSON_voorheesOOOOh I see what you are saying
21:36JSON_voorheeswe get moz-extension url and just pass that up to the chrome code
21:36JSON_voorheesThat makes total sense
21:36JSON_voorheesI thought you meant something totally different
21:57_6a68yeah, the only possible issue is that certain kinds of messaging will not work for moz-resource scheme vs resource scheme. but with webext providing messaging, I think we are good
21:58_6a68or, maybe the topify window code implicitly requires a specific scheme in the url...hopefully not. probably not
22:29_6a68here's an update on how the context menus in webextensions will be updated to allow dynamically adding items https://bugzilla.mozilla.org/show_bug.cgi?id=1215376#c29
22:29_6a68seems like a good plan to me
22:46JSON_voorheesyeah that sounds like it could work for us
22:55_6a68yup. and we should be able to get rid of all the instances of wrappedJSObject, which will be really important for 57
22:57JSON_voorheeshow do you plan to have messaging without that though?
22:57JSON_voorhees_6a68: that's where the pending commands thing lives
22:58_6a68right, we only had that because there was no messaging port
22:58_6a68instead of adding a command to a queue, you just send it over
22:58JSON_voorheesI think we'll still need it
22:58JSON_voorheesBecause if we are calling window.open from the bootstrap I don't think we'll have access to the port
22:58_6a68aight, we could wait to remove that and just try to get away from the sdk
22:59JSON_voorheeseven if the react app lives in the webextension directory
22:59JSON_voorheesWell we need to figure that out cus I'm not gunna wanna do another big rewrite after this one
22:59_6a68the way I think this works is: bootstrap and the webextension background page can communicate via the port that's set up at startup, then the webextension background page and the react app live on the same "domain", so they can communicate via plain old regular postmessage
23:00_6a68I&#39;m fuzzy on the background page <-> react app communication, but I think workers are available too, it seems like we should be able to put something together
23:00JSON_voorheesSee I don&#39;t think the react app with actually be able to communicate with the background page
23:00JSON_voorheesThat would be great if it could
23:01_6a68they are both pages on the same &quot;domain&quot; (in an extended sense)
23:01JSON_voorheesI guess I don&#39;t understand what you mean by &quot;domain&quot;
23:01_6a68moz-extension://foo/_background.html and moz-extension://foo/path/to/default.html
23:01JSON_voorheesooh I see
23:01_6a68er, not domain, but same origin, in the sense of same origin policy
23:01JSON_voorheesyeah I got u
23:01JSON_voorheeshmm
23:01JSON_voorheesI guess we just have to test it
23:02_6a68so the background page acts as a proxy between the bootstrap and the react app, ferrying messages between the two
23:02_6a68yeah
23:02_6a68I bet it&#39;ll work
23:02JSON_voorheesIt just really makes a difference between how I set this up
23:02JSON_voorheesAnd there is a lot of code to write
23:02JSON_voorheesI&#39;ll try that method first
23:03_6a68again, we could just leave the wrappedJSObject stuff in place for now, and get off the SDK
23:03_6a68but both things probably should be done by 57
23:05JSON_voorheestrue, hmm
23:05JSON_voorheesMaybe I&#39;ll just shoot for that first
23:05JSON_voorheesCus I know that&#39;ll work
23:05JSON_voorheesThen we can do the other in a branch while qa is testing or something
23:05_6a68yeah
23:06_6a68I&#39;m good to wait, I think the addons team can help us if we get stuck later
23:06_6a68it is possible that like, postmessage assumes you&#39;re on http(s) and won&#39;t work for moz-extension, somethign weird like that
23:09JSON_voorheestryue
12 Jul 2017
No messages
   
Last message: 10 days and 12 hours ago