nsIDOMWindowUtils.isInModalState() not working

岁酱吖の 提交于 2019-12-24 11:54:13

问题


I get the utils of the window like this:

var utils = Services.wm.getMostRecentWindow('navigator:browser').
            QueryInterface(Components.interfaces.nsIInterfaceRequestor).
            getInterface(Components.interfaces.nsIDOMWindowUtils);

then running this code says its not a function:

Services.prompt.alert(null, 'is modal?', utils.isInModalState())
//Exception: utils.isInModalState is not a function

even though it says in the documentation it is.

I am not able to run this code either:

utils.enterModalState()

It runs without error but the window does not enter or leave modal state.


回答1:


The .isInModalState property is actually tagged [noscript], so it is not available in Javascript, only C++.

.enterModalState() doesn't do what you think it does. It does not make a window UI-modal (like an alert dialog). It just essentially suspends scripts and event processing in the window.



来源:https://stackoverflow.com/questions/24684696/nsidomwindowutils-isinmodalstate-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!