GoogleChromeLabs / ProjectVisBug

FireBug for designers › Edit any webpage, in any state https://a.nerdy.dev/gimme-visbug
https://visbug.web.app
Apache License 2.0
5.49k stars 290 forks source link

Firefox extension #102

Open argyleink opened 6 years ago

argyleink commented 6 years ago

Verified the custom element renders and is fully operational, so it needs an extension build process created, needs a firefox extension lifecycle integration, and some marketing assets to prep for publishing.

lannonbr commented 6 years ago

Would to love use this across both Chrome and Firefox

argyleink commented 6 years ago

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Porting_a_Google_Chrome_extension LOE is low, gotta do this soon!

argyleink commented 6 years ago

workin on this, there's bugs:

https://github.com/argyleink/ProjectVisBug/tree/feature/firefox-extension

argyleink commented 6 years ago

steps to setup dev env:

hope that helps someone...

hfiguiere commented 6 years ago

For the icon, I have that commit to fix it: https://github.com/hfiguiere/ProjectVisBug/commit/0e25e52c97b6af39971ceee826cf94bc0a58dc3b

argyleink commented 5 years ago

turns out custom element classes are having a hard time initializing in content script environments link to issue known by firefox team https://bugzilla.mozilla.org/show_bug.cgi?id=1492002#c7

kud commented 5 years ago

Thank you for your work @argyleink I can't wait to see it on firefox!

argyleink commented 4 years ago

we have a new lead to get around the issue, we're going to try injecting visbug from the content script, like

var script = document.createElement('script');
script.src = chrome.runtime.getURL('bundle.js);
document.body.appendChild(script);

which should get us around the current issue (and likely open up 1 or 2 new ones)

will post back soon!

argyleink commented 4 years ago
Screen Shot 2020-01-15 at 10 57 49 AM

working through the issues, closer every day

argyleink commented 4 years ago

huge win, just got Visbug to launch on any page as an addon!! 🥂

Screen Shot 2020-01-15 at 1 00 12 PM
argyleink commented 4 years ago

to try it out, clone this repo, swap to the firefox-addon branch, run npm run extension:firefox and that's it! it'll open firefox with visbug installed. give it a try!? there's plenty of bugs, list them all!

corysimmons commented 4 years ago

@argyleink What's the best way to live reload this during dev?

argyleink commented 4 years ago

for VisBug general dev, you don't need the extension builds. you can do most the debugging you need in the sandbox page at localhost:3000 with npm i && npm start

for VisBug extension dev, where you want changes from extension lifecycle and visbug web component bundling, that's a bit more involved:

kezzbracey commented 4 years ago

This is a hacky work around for the missing tuts images, so I thought I'd just post it here instead of a PR.

Instead of using a proper setter this gets the addon's URL into the component through an attribute.

So inject.js has:

let tutsBaseURL = src_path.slice(0, src_path.lastIndexOf('/'))
visbug.setAttribute('tutsBaseURL', tutsBaseURL)
// visbug.tutsBaseURL = src_path.slice(0, src_path.lastIndexOf('/'))

And the component constructor has:

// this._tutsBaseURL   = 'tuts' // can be set by content script
this._tutsBaseURL = this.getAttribute('tutsBaseURL');

It ain't pretty, but it gets the images showing up at least.

corysimmons commented 4 years ago
set tutsBaseURL(url) {
    console.log(111111)
    this._tutsBaseURL = url
    this.setup()
  }

How come my console.log doesn't work? :\

The setter is getting triggered in inject.js right?

visbug.tutsBaseURL = src_path.slice(0, src_path.lastIndexOf('/'))

argyleink commented 4 years ago

per the suggestion from @kezzbracey I've updated the logic to use attributes instead properties, and that resolves the path issue to the howto gifs 👍

there's some perf issues to fix, style inspect bugs, syncing color preferences across your firefox instances, etc. plenty of stuff, but support looks within view.

dotproto commented 4 years ago

Just popping in to say I'm interested in helping out with this. I'm currently planning to work on this in my office hours this week. I'll report back on my findings 😁