17 | | In Internals.cpp, I made a new function to return the data I needed. I copied the list from the Document class into a DOMStringList. This let me expose it to JavaScript as a return value. |
18 | | To generate a tie between Internals.cpp and the exposed JavaScript, I added the corresponding function in “internals.idl”. (If you are an old school Windows programmer new to WebKit, note that this is WebKit idl, don’t confuse it with the idl used for RPC). |
19 | | Internals needed the functions that it calls in the document object to be exported so it can find them. This means modifying Source/WebCore/WebCore.exp.in (for Mac), Source/WebKit2/win/WebKit2.def (for Windows), and Source/autotools/symbols.filter (for GTK+). It needs a c++ decorated name for that platform. The decorated name for the Mac and GTK+ look similar (one less leading underscore, otherwise the same). Note that symbols.filter ends with a semicolon, and the others do not. The files are sorted, so maintain the sort order when you add your symbol. |
20 | | In the javascript of the layout test, I call the new method as “window.internals.my-method(). I was able to check in JS that the data returned matched what the test expected, and print PASS or FAIL into the results. |
| 17 | |
| 18 | - In Internals.cpp, I made a new function to return the data I needed. I copied the list from the Document class into a DOMStringList. This let me expose it to JavaScript as a return value. |
| 19 | |
| 20 | - To generate a tie between Internals.cpp and the exposed JavaScript, I added the corresponding function in “internals.idl”. (If you are an old school Windows programmer new to WebKit, note that this is WebKit idl, don’t confuse it with the idl used for RPC). |
| 21 | |
| 22 | - Internals needed the functions that it calls in the document object to be exported so it can find them. This means modifying Source/WebCore/WebCore.exp.in (for Mac), Source/WebKit2/win/WebKit2.def (for Windows), and Source/autotools/symbols.filter (for GTK+). It needs a c++ decorated name for that platform. The decorated name for the Mac and GTK+ look similar (one less leading underscore, otherwise the same). Note that symbols.filter ends with a semicolon, and the others do not. The files are sorted, so maintain the sort order when you add your symbol. |
| 23 | |
| 24 | - In the javascript of the layout test, I call the new method as “window.internals.my-method(). I was able to check in JS that the data returned matched what the test expected, and print PASS or FAIL into the results. |