如何找到打开“添加新书签”的Firefox代码?窗口? [英] How can I find Firefox code that opens "Add new Bookmark" window?
问题描述
谢谢!
请参阅 - 目前有两个用于通过Mozilla代码搜索的在线工具:DXR和MXR。前者更新更先进,后者更简单,更成熟。使用以下任何一种方式:
- 搜索您要查找的标签:将此链接加入书签 li>
找到一个本地化文件(通常是
.dtd
或.properties
),可读的标签,在这种情况下: browser / locales / en-US / chrome / browser / browser.dtd :
ENTITY bookmarkThisLinkCmd.label将此链接加入书签>
-
搜索您找到的内部名称: bookmarkThisLinkCmd.label
-
找到显示在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();/>
-
找到
gContextMenu
:正则表达式:gContextMenu [^ A-Za-z。] - 有一堆命中,他们都在做gContextMenu = new nsContextMenu(this,event.shiftKey);
-
最后找到
.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:
- Search for the label you're looking for: "Bookmark this link"
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">
Search for the internal name you found: bookmarkThisLinkCmd.label
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 underobj-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();"/>
Find the definition of
gContextMenu
: regexp:gContextMenu[^A-Za-z.] - there's a bunch of hits, all of them doinggContextMenu = new nsContextMenu(this, event.shiftKey);
Finally find the definition of
.bookmarkLink
: browser/base/content/nsContextMenu.js#1690
这篇关于如何找到打开“添加新书签”的Firefox代码?窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!