Appending a new line in Source/WebCore/Sources.txt:
JSNiNiTest.cpp
Add $(WebCore)/NiNiTest.idl to JS_BINDING_IDLS in Source/WebCore/DerivedSources.txt
JS_BINDING_IDLS := \ + $(WebCore)/NiNiTest.idl \
The webkit will generate corresponding JSNiNiTest.cpp and JSNiNiTest.cpp for us.
Now, because the requestBrowserQuit in page->chrome().client().requestBrowserQuit(); doesn’t exist, we have to implement that function to make it come true. We add a virutal function in class ChromeClient in /Source/WebCore/page/ChromeClient.h
class ChromeClient { public: + virtual void requestBrowserQuit() { }
Then overwrite it in the derived class WebChromeClient in Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
class WebChromeClient final : public WebCore::ChromeClient { WTF_MAKE_TZONE_ALLOCATED(WebChromeClient); public: WebChromeClient(WebPage&); ~WebChromeClient();
We try to send a message through IPC to WebPageProxy, same, there is nothing can handle this message or even send it.
Adding a new function to class WebPageProxy in Source/WebKit/UIProcess/WebPageProxy.h
class WebPageProxy final : public API::ObjectImpl<API::Object::Type::Page>, public IPC::MessageReceiver { public: static Ref<WebPageProxy> create(PageClient&, WebProcessProxy&, Ref<API::PageConfiguration>&&); virtual ~WebPageProxy();
void ref() const final { API::ObjectImpl<API::Object::Type::Page>::ref(); } void deref() const final { API::ObjectImpl<API::Object::Type::Page>::deref(); }