如何找到打开“添加新书签”的Firefox代码?窗口? [英] How can I find Firefox code that opens "Add new Bookmark" window?

查看:158
本文介绍了如何找到打开“添加新书签”的Firefox代码?窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个应该添加新书签的Firefox附加组件。我正在考虑使用Mozilla Firefox浏览器中已经存在的一些功能。据我所知,Firefox浏览器是用XUL编写的,代码是开源的。我怎样才能找到执行任何具体行动的代码,就像在这种情况下,当我点击上下文菜单项书签此链接窗口出现新书签,我怎么能找到打开此窗口的代码?



谢谢!

解决方案

请参阅 - 目前有两个用于通过Mozilla代码搜索的在线工具:DXR和MXR。前者更新更先进,后者更简单,更成熟。使用以下任何一种方式:


  1. 搜索您要查找的标签:将此链接加入书签 li>

    找到一个本地化文件(通常是 .dtd .properties ),可读的标签,在这种情况下: browser / locales / en-US / chrome / browser / browser.dtd

      ENTITY bookmarkThisLinkCmd.label将此链接加入书签> 


  2. 搜索您找到的内部名称: bookmarkThisLinkCmd.label


  3. 找到显示在UI中的代码,通常是 .xul .js * ,在这种情况下浏览器/ base / content / browser-context.inc - 一个通过预处理器包含在许多XUL文件中的文件。 (请注意,DXR还会在 obj-x86_64-pc-linux-gnu 下显示一堆结果 - 这些是在生成过程中生成的结果,而不是原始源代码, )

     < menuitem id =context-bookmarklink
    label =& bookmarkThisLinkCmd.label;
    accesskey =& bookmarkThisLinkCmd.accesskey;
    oncommand =gContextMenu.bookmarkLink();/>


  4. 找到 gContextMenu 正则表达式:gContextMenu [^ A-Za-z。] - 有一堆命中,他们都在做

      gContextMenu = new nsContextMenu(this,event.shiftKey); 


  5. 最后找到 .bookmarkLink 浏览器/ base / content / nsContextMenu.js#1690



I am writing a Firefox Add-on that is supposed to add new bookmarks. I am thinking of employing some of the functionality that is already present in the Mozilla Firefox browser. As I understand, the Firefox browser is written in XUL and the code is open source. How can I find the code that performs any specific action, like in this case when I click the context menu item "Bookmark this link" a window appears "New Bookmark", how can I find the code that opens this window?

Thank you!

解决方案

See Viewing and searching Mozilla source code online - there currently are two online tools for searching through the Mozilla's code: DXR and MXR. The former is newer and more advanced, the latter is simpler and more mature. Using any of these:

  1. Search for the label you're looking for: "Bookmark this link"
  2. Find a localization file (usually .dtd or .properties), which maps an internal name to the human-readable label, in this case: browser/locales/en-US/chrome/browser/browser.dtd:

    ENTITY bookmarkThisLinkCmd.label      "Bookmark This Link">
    

  3. Search for the internal name you found: bookmarkThisLinkCmd.label

  4. Find the code that displays it in the UI, usually .xul or .js*, in this case browser/base/content/browser-context.inc - a file that's included in a number of XUL files via preprocessor. (Note that DXR also shows you a bunch of results under obj-x86_64-pc-linux-gnu - these are results generated during the build, and not the original source code, and should usually be ignored.)

      <menuitem id="context-bookmarklink"
            label="&bookmarkThisLinkCmd.label;"
            accesskey="&bookmarkThisLinkCmd.accesskey;"
            oncommand="gContextMenu.bookmarkLink();"/>
    

  5. Find the definition of gContextMenu: regexp:gContextMenu[^A-Za-z.] - there's a bunch of hits, all of them doing

     gContextMenu = new nsContextMenu(this, event.shiftKey); 
    

  6. Finally find the definition of .bookmarkLink: browser/base/content/nsContextMenu.js#1690

这篇关于如何找到打开“添加新书签”的Firefox代码?窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆