nsIProcessScriptLoader 编辑
IDL file: mozilla-central/source/dom/base/nsIMessageManager.idl
Inherits from: nsISupports
This interface is used by parent process message managers to load scripts into a child process. The scripts run only once per process. The global object for process scripts is a ContentProcessMessageManager.
Methods
|
void removeDelayedProcessScript(in AString aURL); |
jsval getDelayedProcessScripts(); |
loadProcessScript()
Load a script in the child process. Process scripts are loaded as soon as loadProcessScript()
is called.
If this function is called on a ChromeMessageBroadcaster
, :
- it will load the process script into all child processes.
- if
aAllowDelayedLoad
istrue
, then the script will also be loaded into any new child processes created after theloadProcessScript()
call. Otherwise it will only be loaded into child processes that exist at the time of the call.
If this function is called on a ChromeMessageSender
:
- it will load the process script only into this
ChromeMessageSender
's child process aAllowDelayedLoad
should always betrue
. It's possible that the child process for thisChromeMessageSender
is not yet available at the time of theloadProcessScript()
call, and if you passfalse
in this situation, your process script won't be loaded.
For example:
let ppmm = Services.ppmm.getChildAt(1);
ppmm.loadProcessScript('data:,dump("foo\n");', true);
Parameters
Name | Type | Description |
---|---|---|
aURL | String | URL for the script to load. aURL must be the absolute URL. data: URLs are also supported. For example data:,dump("foo\n"); |
aAllowDelayedLoad | Boolean | If this flag is If this flag is true, the process script will be loaded into any new child processes created after the If you are calling |
removeDelayedProcessScript()
Removes aURL
from the list of scripts which support delayed load.
This cancels the effect of the aAllowDelayedLoad
flag, meaning that the loader will no longer load the script into new child processes. If you used aAllowDelayedLoad
, you should call this as part of your cleanup (for example, when your add-on is disabled or uninstalled).
Parameters
Name | Type | Description |
---|---|---|
aURL | String | URL for the script to remove. |
getDelayedProcessScripts()
Returns all delayed scripts that will be loaded once a child process becomes available. The return value is a list of pairs [<URL>, false]
.
Returns
List of the delayed scripts. Each script is returned as a pair: [<URL>, false]
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论