This blog post focuses on fixing the bug and merge process of an open-source project: node-WebKit (which can be explained in my previous blog. I want to summarize some methods and accumulate experience. (Note: The following NW is node-WebKit)
Bug
Link to issue on GitHub: https://github.com/rogerwang/node-webkit/issues/403question: in NW, as shown in
<AHref= "Mailto: xxxx@gmail.com">Mail</A>
Such hyperlink labels cannot open the default mail sending client in the system as in the browser (such as chrome. Another example:
<AHref= "GitHub-Windows: // openrepo/https://github.com/rogerwang/node-webkit">Clone in Windows</A>
Such links cannot work normally.
Problem Analysis
-
- At first, I guess why the same link in chrome can be opened normally (some confirmation dialog boxes will pop up based on different protocols ), for example, a dialog box pops up when I click the clone in Windows link of the repository on GitHub. Should this click event on tags in HTML be implemented in WebKit? However, after careful observation, we found that this dialog box is unique in chrome. However, NW is implemented based on the chrome content API. That is to say, in NW, there should be some functions that respond to this event! So I started the process of searching for this function.
- After learning about the chrome architecture and the NW architecture, I began to look for the implementation in chrome as a reference for my patch. At the very beginningCodeThe amount is just a needle in a haystack. Then we suddenly thought that we could find out if any related bug exists in chrome? In this case, you can check the patch record and probably know where to implement it! So on the chrome issue tracking system: https://code.google.com/p/chromium/issues/list search mailto status = Fixed (all issues), is this simple keyword search, I found the following issue: https://code.google.com/p/chromium/issues/detail? Id = 20696. Read the description of this issue carefully and find that it is consistent with the Code that needs to be completed in NW!
-
- But when I am very happy to open a link and want to see which code has been modified, my God, how can this code disappear. (In Chrome projects, some objects are often moved to a folder, so it is not surprising, but the file names are generally not changed ). So I started searching for the external_protocol_handler.cc file.
- Google chromium has a powerful tool in this project! Code Search: https://code.google.com/p/chromium/codesearch this tool has recently upgraded some features (https://groups.google.com/a/chromium.org/forum! Starred/chromium-dev/lnkihhajvya )! Use external_protocol_handler to search and find the following code: External. After carefully reading the comments, I am more sure what I need.
-
- The next thing is to read the code and find out what you need. The commit is as follows: https://github.com/rogerwang/node-webkit/commit/0bcc9840660d390c463ffc061a55ce280d5dc629
What have I learned?
- A problem, even if you don't seem to have a clue, can be solved through a certain method: using tools rationally and step by step under a slightly organized inference.
- Think about itProgramMember.