Pedro, As I'm looking through the code a bit deeper, I see some context menu stuff already happening. Is this code related to the same idea?
And thanks for clearing it up a bit more. Like I said, I'm new to the Chrome Extensions world. So Firebug Lite doesn't have a content script then? Just the page script (firebug.js) Also, that was just code I paste binned. I haven't started a new extension, I've just been modifying the code. Thanks. R. Jacob Goldsborough http://www.rjgoldsborough.com Mobile == +1.202.713.5894 Drupal user #469148 <http://drupal.org/user/469148> Skype == rjgoldsborough IRC nick == rjgoldsborough On Thu, Nov 11, 2010 at 13:09, Pedro Simonetti Garcia < [email protected]> wrote: > Jake, > > 2010/11/10 Jake Goldsborough <[email protected]> > > Hey Pedro et al, thanks for the emails back. > > > Thanks for contacting us! :-) > > > >> You can see the code I've used here. http://pastebin.com/fSucGCr9 >> >> I've started working on this plugin and am running into some trouble. >> The API shows calling an external js file in the background.html so I >> created contextmenu.js. >> > > In order to make extensions as secure as possible in Chrome, the > communication with the page is very restricted. Background pages can only > talk to Content Scripts, and Content Scripts can talk to page, but only > using the DOM (not JavaScript directly): > > Background pages ---> Content Scripts ---> page scripts (Firebug Lite) > > I suggest reading this to see how to communicate with the page: > > http://code.google.com/chrome/extensions/trunk/content_scripts.html#host-page-communication > > Is also good to consider the security risks: > > http://code.google.com/chrome/extensions/trunk/messaging.html#security-considerations > > I made a confusion in my last post. The correct order should be: > > 1) Find the element to be inspected - listen to "oncontentmenu" events in > the *page* to track the clicked element (running the *page*). > > 2) Detect context menu click - use Chrome's API to detect context-menu > click (running on a *background page*) and send a message to the *content > script* indicating that a click happened. > > 3) Communicate with the page - from the *content script* send a message to > the *page* indicating that a context-menu click happened. > > 4) Select the element in HTML Panel - running on the *page*, listen to the > *content script" message indicating a context-menu click, and execute the > following code to select the element: > > > Firebug.chrome.selectPanel("HTML"); > Firebug.HTML.select(elementToBeInspected); > > > >> I've got the Firebug Lite item showing up in the context menu. >> I have tried to send a message onclick to both the content script and >> background pages but neither seem to work. I've put a test alert and it >> never shows up. >> I also am not really sure how to listen for a context menu click. I could >> only find api functions to create delete and update. >> > > Yes, I tried your code and it won't work because Firebug Lite is running at > the page, the the context menu action is handled at the background page. > > Also, if you're creating a new extension (judging by the pastebin sample) > you'll have problems too because there's more work to do to communicate from > one extension to another. I suggest is to work on Firebug Lite extension's > code instead, and then when you get a working version without bugs I'll > revise the code and commit it our repository, making it available to our > users in the next beta release. Of course, I'll give you the proper credit > for the patch. ;-) > > > This is my first go at a chrome extension so any feedback or pointers would >> be greatly appreciated. >> > > There are a few more things to consider but let's concentrate on the most > important ones. We need to handle the case when Firebug Lite is inactive, > which is related to this issue: > > http://code.google.com/p/fbug/issues/detail?id=3166 > > The problem is that we need some kind of "Browser Help Object" that will > act even when Firebug Lite is inactive. This BHO will basically handle these > cases: > > * If a user press F12 when Firebug Lite is inactive, it should activate it > and open. > * If a user press CTRL+SHIFT+C when Firebug Lite is inactive, it should > activate it and start inspecting. > * If a user select "Inspect element" from context-menu when Firebug Lite is > inactive, it should activate it and inspect the clicked element. > > There are a few things we need to change in Firebug Lite to make it easier > to solve the related issues: 1) split the current content script file in two > (a small BHO-like file, and the Firebug Lite app file); 2) create a API > method to dispatch messages from Chrome to Firebug (there is currently only > a Firebug to Chrome method); 3) Make Chrome extension work in Development > Mode [*] to make the development of Chrome specific code easier (without > requiring building the project). > > [*] http://getfirebug.com/firebuglite#DevelopmentMode > > #1 and #2 are easy and I'll commit a patch now so it will be much easier to > you to proceed from that. > > #3 will require changing the location of the manifest.json file so I need > to rethink how Chrome extension will be built and deployed, so I want to > think carefully. > > regards, > > Pedro Simonetti. > > > Thanks for giving me the chance to help contribute back. I'm not sure what >> I'd do without Firebug, and Firebug Lite really makes it possible to develop >> in Chrome. >> >> >> R. Jacob Goldsborough >> http://www.rjgoldsborough.com >> Mobile == +1.202.713.5894 >> Drupal user #469148 <http://drupal.org/user/469148> >> Skype == rjgoldsborough >> IRC nick == rjgoldsborough >> >> >> >> On Mon, Nov 8, 2010 at 23:17, Pedro Simonetti Garcia < >> [email protected]> wrote: >> >>> >>> 2010/11/8 rjgoldsborough <[email protected]> >>> >>> Hi all. I came across >>>> http://code.google.com/chrome/extensions/trunk/contextMenus.html >>>> and was wondering if there are any plans to integrate this with >>>> firebug. It would be very handy to be able to right click and select >>>> "Firebug" just like in Firefox. >>> >>> >>> Sure, as Steven pointed please star the following issue to get notified >>> about our progress: >>> >>> http://code.google.com/p/fbug/issues/detail?id=3579 >>> >>> >>>> I would be willing to give it a shot, >>>> >>>> but I didn't find anywhere to download the current code. Thanks! >>>> >>> >>> Great! You can find a link to download [1] at our site [2], but as >>> Sebastian suggested if you're going to work with Firebug Lite code it is >>> recommended to download the code directly from our repository: >>> >>> http://fbug.googlecode.com/svn/lite/branches/firebug1.4/test/ >>> >>> The actual code for the extension is under "/build/chrome-extension". >>> >>> I'm focused right now on complex core changes in Firebug Lite so I'll be >>> glad to see contributions from the community so I can stay focused on the >>> hard work. I'm open to give you instructions how to implement this, so if >>> you need help just ask. >>> >>> Implement this feature is easy, but not so easy as one might think. >>> Chrome does not include a reference to the clicked element that activated >>> the content menu so you'll have to find that element first, and note that >>> the context menu is handled at a background page and the Firebug Lite is >>> running at the page. >>> >>> 1) Find the element to be inspected - listen to "oncontentmenu" events in >>> the page to track the clicked element (running on a content script). >>> >>> 2) Detect context menu click - use Chrome's API to detect context-menu >>> click (running on a background page) and send a message to the content >>> script indicating that a click happened. >>> >>> 3) Select the element in HTML Panel - running on a content script, listen >>> to background's page message indicating a context-menu click, and execute >>> the following code to select the element: >>> >>> Firebug.chrome.selectPanel("HTML"); >>> Firebug.HTML.select(elementToBeInspected); >>> >>> If you need help understanding Firebug Lite code, just ask. >>> >>> regards, >>> >>> Pedro Simonetti. >>> >>> >>> [1] https://getfirebug.com/releases/lite/latest/firebug-lite.tar.tgz >>> [2] http://getfirebug.com/firebuglite#Stable >>> >>> >>> >>> >>> >>>> >>>> -- >>>> >>>> You received this message because you are subscribed to the Google >>>> Groups "Firebug" group. >>>> To post to this group, send email to [email protected]. >>>> To unsubscribe from this group, send email to >>>> [email protected]<firebug%[email protected]> >>>> . >>>> For more options, visit this group at >>>> http://groups.google.com/group/firebug?hl=en. >>>> >>>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Firebug" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]<firebug%[email protected]> >>> . >>> For more options, visit this group at >>> http://groups.google.com/group/firebug?hl=en. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Firebug" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]<firebug%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/firebug?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Firebug" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<firebug%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/firebug?hl=en. > -- You received this message because you are subscribed to the Google Groups "Firebug" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/firebug?hl=en.
