Prompt Service Reference
This is the JSDoc from the Prompter.sys.mjs implementation. You can find the full interface definition in nsIPromptService.idl.
- class Prompter()
Implements nsIPromptService and nsIPromptFactory
- Prompter.alert(domWin, title, text)
Puts up an alert dialog with an OK button.
- Arguments:
domWin (mozIDOMWindowProxy) – The parent window or null.
title (String) – Text to appear in the title of the dialog.
text (String) – Text to appear in the body of the dialog.
- Prompter.alertBC(browsingContext, modalType, title, text)
Puts up an alert dialog with an OK button.
- Arguments:
browsingContext (BrowsingContext) – The browsing context the prompt should be opened for.
modalType (Number) – The modal type of the prompt. nsIPromptService.<MODAL_TYPE_WINDOW|MODAL_TYPE_TAB|MODAL_TYPE_CONTENT>
title (String) – Text to appear in the title of the dialog.
text (String) – Text to appear in the body of the dialog.
- Prompter.alertCheck(domWin, title, text, checkLabel, checkValue)
Puts up an alert dialog with an OK button and a labeled checkbox.
- Arguments:
domWin (mozIDOMWindowProxy) – The parent window or null.
title (String) – Text to appear in the title of the dialog.
text (String) – Text to appear in the body of the dialog.
checkLabel (String) – Text to appear with the checkbox.
checkValue (Object) – Contains the initial checked state of the checkbox when this method is called and the final checked state after this method returns.
- Prompter.alertCheckBC(browsingContext, modalType, title, text, checkLabel, checkValue)
Puts up an alert dialog with an OK button and a labeled checkbox.
- Arguments:
browsingContext (BrowsingContext) – The browsing context the prompt should be opened for.
modalType (Number) – The modal type of the prompt. nsIPromptService.<MODAL_TYPE_WINDOW|MODAL_TYPE_TAB|MODAL_TYPE_CONTENT>
title (String) – Text to appear in the title of the dialog.
text (String) – Text to appear in the body of the dialog.
checkLabel (String) – Text to appear with the checkbox.
checkValue (Object) – Contains the initial checked state of the checkbox when this method is called and the final checked state after this method returns.
- Prompter.asyncAlert(browsingContext, modalType, title, text)
Puts up an alert dialog with an OK button.
- Arguments:
browsingContext (BrowsingContext) – The browsing context the prompt should be opened for.
modalType (Number) – The modal type of the prompt. nsIPromptService.<MODAL_TYPE_WINDOW|MODAL_TYPE_TAB|MODAL_TYPE_CONTENT>
title (String) – Text to appear in the title of the dialog.
text (String) – Text to appear in the body of the dialog.
- Returns:
Promise – A promise which resolves when the prompt is dismissed.
- Prompter.asyncAlertCheck(browsingContext, modalType, title, text, checkLabel, checkValue)
Puts up an alert dialog with an OK button and a labeled checkbox.
- Arguments:
browsingContext (BrowsingContext) – The browsing context the prompt should be opened for.
modalType (Number) – The modal type of the prompt. nsIPromptService.<MODAL_TYPE_WINDOW|MODAL_TYPE_TAB|MODAL_TYPE_CONTENT>
title (String) – Text to appear in the title of the dialog.
text (String) – Text to appear in the body of the dialog.
checkLabel (String) – Text to appear with the checkbox.
checkValue (Boolean) – The initial checked state of the checkbox.
- Returns:
Promise.<nsIPropertyBag.<{checked: Boolean}>> – A promise which resolves when the prompt is dismissed.
- Prompter.asyncConfirm(browsingContext, modalType, title, text)
Puts up a dialog with OK and Cancel buttons.
- Arguments:
browsingContext (BrowsingContext) – The browsing context the prompt should be opened for.
modalType (Number) – The modal type of the prompt. nsIPromptService.<MODAL_TYPE_WINDOW|MODAL_TYPE_TAB|MODAL_TYPE_CONTENT>
title (String) – Text to appear in the title of the dialog.
text (String) – Text to appear in the body of the dialog.
- Returns:
Promise.<nsIPropertyBag.<{ok: Boolean}>> – A promise which resolves when the prompt is dismissed.
- Prompter.asyncConfirmCheck(browsingContext, modalType, title, text, checkLabel, checkValue)
Puts up a dialog with OK and Cancel buttons and a labeled checkbox.
- Arguments:
browsingContext (BrowsingContext) – The browsing context the prompt should be opened for.
modalType (Number) – The modal type of the prompt. nsIPromptService.<MODAL_TYPE_WINDOW|MODAL_TYPE_TAB|MODAL_TYPE_CONTENT>
title (String) – Text to appear in the title of the dialog.
text (String) – Text to appear in the body of the dialog.
checkLabel (String) – Text to appear with the checkbox.
checkValue (Boolean) – The initial checked state of the checkbox.
- Returns:
Promise.<nsIPropertyBag.<{ok: Boolean, checked: Boolean}>> – A promise which resolves when the prompt is dismissed.
- Prompter.asyncConfirmEx(browsingContext, modalType, title, text, flags, button0, button1, button2, checkLabel, checkValue, extraArgs)
Puts up a dialog with up to 3 buttons and an optional, labeled checkbox.
- Arguments:
browsingContext (BrowsingContext) – The browsing context the prompt should be opened for.
modalType (Number) – The modal type of the prompt. nsIPromptService.<MODAL_TYPE_WINDOW|MODAL_TYPE_TAB|MODAL_TYPE_CONTENT>
title (String) – Text to appear in the title of the dialog.
text (String) – Text to appear in the body of the dialog.
flags (Number) – A combination of Button Flags.
button0 (String) – Used when button 0 uses TITLE_IS_STRING.
button1 (String) – Used when button 1 uses TITLE_IS_STRING.
button2 (String) – Used when button 2 uses TITLE_IS_STRING.
checkLabel (String) – Text to appear with the checkbox. Null if no checkbox.
checkValue (Boolean) – The initial checked state of the checkbox.
extraArgs (Object) – Extra arguments for the prompt metadata.
- Returns:
Promise.<nsIPropertyBag.<{buttonNumClicked: Number, checked: Boolean, isExtra1Secondary: Boolean}>> –
- Prompter.asyncPrompt(browsingContext, modalType, title, text, value, checkLabel, checkValue)
Puts up a dialog with an edit field and an optional, labeled checkbox.
- Arguments:
browsingContext (BrowsingContext) – The browsing context the prompt should be opened for.
modalType (Number) – The modal type of the prompt. nsIPromptService.<MODAL_TYPE_WINDOW|MODAL_TYPE_TAB|MODAL_TYPE_CONTENT>
title (String) – Text to appear in the title of the dialog.
text (String) – Text to appear in the body of the dialog.
value (String) – The default value for the dialog text field.
checkLabel (String) – Text to appear with the checkbox. If null, check box will not be shown.
checkValue (Boolean) – The initial checked state of the checkbox.
- Returns:
Promise.<nsIPropertyBag.<{ok: Boolean, checked: Boolean, value: String}>> – A promise which resolves when the prompt is dismissed.
- Prompter.asyncPromptAuth(browsingContext, modalType, channel, level, authInfo)
Requests a username and a password. Shows a dialog with username and password field, depending on flags also a domain field.
- Arguments:
browsingContext (BrowsingContext) – The browsing context the prompt should be opened for.
modalType (Number) – The modal type of the prompt. nsIPromptService.<MODAL_TYPE_WINDOW|MODAL_TYPE_TAB|MODAL_TYPE_CONTENT>
channel (nsIChannel) – The channel that requires authentication.
level (Number) – Security level of the credential transmission. Any of nsIAuthPrompt2.<LEVEL_NONE|LEVEL_PW_ENCRYPTED|LEVEL_SECURE>
authInfo (nsIAuthInformation) – Authentication information object.
- Returns:
Promise.<nsIPropertyBag.<{ok: Boolean}>> – A promise which resolves when the prompt is dismissed.
- Prompter.asyncPromptPassword(browsingContext, modalType, title, text, pass)
Puts up a dialog with a password field.
- Arguments:
browsingContext (BrowsingContext) – The browsing context the prompt should be opened for.
modalType (Number) – The modal type of the prompt. nsIPromptService.<MODAL_TYPE_WINDOW|MODAL_TYPE_TAB|MODAL_TYPE_CONTENT>
title (String) – Text to appear in the title of the dialog.
text (String) – Text to appear in the body of the dialog.
pass (String) – Contains the default value for the password field.
- Returns:
Promise.<nsIPropertyBag.<{ok: Boolean, pass: String}>> – A promise which resolves when the prompt is dismissed.
- Prompter.asyncPromptUsernameAndPassword(browsingContext, modalType, title, text, user, pass)
Puts up a dialog with an edit field and a password field.
- Arguments:
browsingContext (BrowsingContext) – The browsing context the prompt should be opened for.
modalType (Number) – The modal type of the prompt. nsIPromptService.<MODAL_TYPE_WINDOW|MODAL_TYPE_TAB|MODAL_TYPE_CONTENT>
title (String) – Text to appear in the title of the dialog.
text (String) – Text to appear in the body of the dialog.
user (String) – Default value for the username field.
pass (String) – Contains the default value for the password field.
- Returns:
Promise.<nsIPropertyBag.<{ok: Boolean, user: String, pass: String}>> – A promise which resolves when the prompt is dismissed.
- Prompter.asyncSelect(browsingContext, modalType, title, text, list)
Puts up a dialog box which has a list box of strings from which the user may make a single selection.
- Arguments:
browsingContext (BrowsingContext) – The browsing context the prompt should be opened for.
modalType (Number) – The modal type of the prompt. nsIPromptService.<MODAL_TYPE_WINDOW|MODAL_TYPE_TAB|MODAL_TYPE_CONTENT>
title (String) – Text to appear in the title of the dialog.
text (String) – Text to appear in the body of the dialog.
list (Array.<String>) – The list of strings to display.
- Returns:
Promise.<nsIPropertyBag.<{selected: Number, ok: Boolean}>> – A promise which resolves when the prompt is dismissed.
- Prompter.confirm(domWin, title, text)
Puts up a dialog with OK and Cancel buttons.
- Arguments:
domWin (mozIDOMWindowProxy) – The parent window or null.
title (String) – Text to appear in the title of the dialog.
text (String) – Text to appear in the body of the dialog.
- Returns:
Boolean – true for OK, false for Cancel.
- Prompter.confirmBC(browsingContext, modalType, title, text)
Puts up a dialog with OK and Cancel buttons.
- Arguments:
browsingContext (BrowsingContext) – The browsing context the prompt should be opened for.
modalType (Number) – The modal type of the prompt. nsIPromptService.<MODAL_TYPE_WINDOW|MODAL_TYPE_TAB|MODAL_TYPE_CONTENT>
title (String) – Text to appear in the title of the dialog.
text (String) – Text to appear in the body of the dialog.
- Returns:
Boolean – true for OK, false for Cancel.
- Prompter.confirmCheck(domWin, title, text, checkLabel, checkValue)
Puts up a dialog with OK and Cancel buttons and a labeled checkbox.
- Arguments:
domWin (mozIDOMWindowProxy) – The parent window or null.
title (String) – Text to appear in the title of the dialog.
text (String) – Text to appear in the body of the dialog.
checkLabel (String) – Text to appear with the checkbox.
checkValue (Object) – Contains the initial checked state of the checkbox when this method is called and the final checked state after this method returns.
- Prompter.confirmCheckBC(browsingContext, modalType, title, text, checkLabel, checkValue)
Puts up a dialog with OK and Cancel buttons and a labeled checkbox.
- Arguments:
browsingContext (BrowsingContext) – The browsing context the prompt should be opened for.
modalType (Number) – The modal type of the prompt. nsIPromptService.<MODAL_TYPE_WINDOW|MODAL_TYPE_TAB|MODAL_TYPE_CONTENT>
title (String) – Text to appear in the title of the dialog.
text (String) – Text to appear in the body of the dialog.
checkLabel (String) – Text to appear with the checkbox.
checkValue (Object) – Contains the initial checked state of the checkbox when this method is called and the final checked state after this method returns.
- Returns:
Boolean – true for OK, false for Cancel
- Prompter.confirmEx(domWin, title, text, flags, button0, button1, button2, checkLabel, checkValue)
Puts up a dialog with up to 3 buttons and an optional, labeled checkbox.
Buttons are numbered 0 - 2. Button 0 is the default button unless one of the Button Default Flags is specified.
A button may use a predefined title, specified by one of the Button Title Flags values. Each title value can be multiplied by a position value to assign the title to a particular button. If BUTTON_TITLE_IS_STRING is used for a button, the string parameter for that button will be used. If the value for a button position is zero, the button will not be shown.
In general, flags is constructed per the following example:
- flags = (BUTTON_POS_0) * (BUTTON_TITLE_AAA) +
(BUTTON_POS_1) * (BUTTON_TITLE_BBB) + BUTTON_POS_1_DEFAULT;
where “AAA” and “BBB” correspond to one of the button titles.
- Arguments:
domWin (mozIDOMWindowProxy) – The parent window or null.
title (String) – Text to appear in the title of the dialog.
text (String) – Text to appear in the body of the dialog.
flags (Number) – A combination of Button Flags.
button0 (String) – Used when button 0 uses TITLE_IS_STRING.
button1 (String) – Used when button 1 uses TITLE_IS_STRING.
button2 (String) – Used when button 2 uses TITLE_IS_STRING.
checkLabel (String) – Text to appear with the checkbox. Null if no checkbox.
checkValue (Object) – Contains the initial checked state of the checkbox when this method is called and the final checked state after this method returns.
- Returns:
Number – The index of the button pressed.
- Prompter.confirmExBC(browsingContext, modalType, title, text, flags, button0, button1, button2, checkLabel, checkValue)
Puts up a dialog with up to 3 buttons and an optional, labeled checkbox.
- Arguments:
browsingContext (BrowsingContext) – The browsing context the prompt should be opened for.
modalType (Number) – The modal type of the prompt. nsIPromptService.<MODAL_TYPE_WINDOW|MODAL_TYPE_TAB|MODAL_TYPE_CONTENT>
title (String) – Text to appear in the title of the dialog.
text (String) – Text to appear in the body of the dialog.
flags (Number) – A combination of Button Flags.
button0 (String) – Used when button 0 uses TITLE_IS_STRING.
button1 (String) – Used when button 1 uses TITLE_IS_STRING.
button2 (String) – Used when button 2 uses TITLE_IS_STRING.
checkLabel (String) – Text to appear with the checkbox. Null if no checkbox.
checkValue (Object) – Contains the initial checked state of the checkbox when this method is called and the final checked state after this method returns.
- Returns:
Number – The index of the button pressed.
- Prompter.confirmUserPaste(windowContext)
Displays a contextmenu to get user confirmation for clipboard read. Only one context menu can be opened at a time.
- Arguments:
windowContext (WindowContext) – The window context that initiates the clipboard operation.
- Returns:
Promise.<nsIPropertyBag.<{ok: Boolean}>> – A promise which resolves when the contextmenu is dismissed.
- Prompter.prompt(domWin, title, text, value, checkLabel, checkValue)
Puts up a dialog with an edit field and an optional, labeled checkbox.
- Arguments:
domWin (mozIDOMWindowProxy) – The parent window or null.
title (String) – Text to appear in the title of the dialog.
text (String) – Text to appear in the body of the dialog.
value (Object) – Contains the default value for the dialog field when this method is called (null value is ok). Upon return, if the user pressed OK, then this parameter contains a newly allocated string value. Otherwise, the parameter’s value is unmodified.
checkLabel (String) – Text to appear with the checkbox. If null, check box will not be shown.
checkValue (Object) – Contains the initial checked state of the checkbox when this method is called and the final checked state after this method returns.
- Returns:
Boolean – true for OK, false for Cancel.
- Prompter.promptAuth(domWin, channel, level, authInfo)
Requests a username and a password. Shows a dialog with username and password field, depending on flags also a domain field.
- Arguments:
domWin (mozIDOMWindowProxy) – The parent window or null.
channel (nsIChannel) – The channel that requires authentication.
level (Number) – Security level of the credential transmission. Any of nsIAuthPrompt2.<LEVEL_NONE|LEVEL_PW_ENCRYPTED|LEVEL_SECURE>
authInfo (nsIAuthInformation) – Authentication information object.
- Returns:
Boolean – true: Authentication can proceed using the values in the authInfo object. false: Authentication should be cancelled, usually because the user did not provide username/password.
- Prompter.promptAuthBC(browsingContext, modalType, channel, level, authInfo)
Requests a username and a password. Shows a dialog with username and password field, depending on flags also a domain field.
- Arguments:
browsingContext (BrowsingContext) – The browsing context the prompt should be opened for.
modalType (Number) – The modal type of the prompt. nsIPromptService.<MODAL_TYPE_WINDOW|MODAL_TYPE_TAB|MODAL_TYPE_CONTENT>
channel (nsIChannel) – The channel that requires authentication.
level (Number) – Security level of the credential transmission. Any of nsIAuthPrompt2.<LEVEL_NONE|LEVEL_PW_ENCRYPTED|LEVEL_SECURE>
authInfo (nsIAuthInformation) – Authentication information object.
- Returns:
Boolean – true: Authentication can proceed using the values in the authInfo object. false: Authentication should be cancelled, usually because the user did not provide username/password.
- Prompter.promptBC(browsingContext, modalType, title, text, value, checkLabel, checkValue)
Puts up a dialog with an edit field and an optional, labeled checkbox.
- Arguments:
browsingContext (BrowsingContext) – The browsing context the prompt should be opened for.
modalType (Number) – The modal type of the prompt. nsIPromptService.<MODAL_TYPE_WINDOW|MODAL_TYPE_TAB|MODAL_TYPE_CONTENT>
title (String) – Text to appear in the title of the dialog.
text (String) – Text to appear in the body of the dialog.
value (Object) – Contains the default value for the dialog field when this method is called (null value is ok). Upon return, if the user pressed OK, then this parameter contains a newly allocated string value. Otherwise, the parameter’s value is unmodified.
checkLabel (String) – Text to appear with the checkbox. If null, check box will not be shown.
checkValue (Object) – Contains the initial checked state of the checkbox when this method is called and the final checked state after this method returns.
- Returns:
Boolean – true for OK, false for Cancel.
- Prompter.promptPassword(domWin, title, text, pass)
Puts up a dialog with a password field.
- Arguments:
domWin (mozIDOMWindowProxy) – The parent window or null.
title (String) – Text to appear in the title of the dialog.
text (String) – Text to appear in the body of the dialog.
pass (Object) – Contains the default value for the password field when this method is called (null value is ok). Upon return, if the user pressed OK, this parameter contains a newly allocated string value. Otherwise, the parameter’s value is unmodified.
- Returns:
Boolean – true for OK, false for Cancel.
- Prompter.promptPasswordBC(browsingContext, modalType, title, text, pass)
Puts up a dialog with a password field.
- Arguments:
browsingContext (BrowsingContext) – The browsing context the prompt should be opened for.
modalType (Number) – The modal type of the prompt. nsIPromptService.<MODAL_TYPE_WINDOW|MODAL_TYPE_TAB|MODAL_TYPE_CONTENT>
title (String) – Text to appear in the title of the dialog.
text (String) – Text to appear in the body of the dialog.
pass (Object) – Contains the default value for the password field when this method is called (null value is ok). Upon return, if the user pressed OK, this parameter contains a newly allocated string value. Otherwise, the parameter’s value is unmodified.
- Returns:
Boolean – true for OK, false for Cancel.
- Prompter.promptUsernameAndPassword(domWin, title, text, user, pass)
Puts up a dialog with an edit field and a password field.
- Arguments:
domWin (mozIDOMWindowProxy) – The parent window or null.
title (String) – Text to appear in the title of the dialog.
text (String) – Text to appear in the body of the dialog.
user (Object) – Contains the default value for the username field when this method is called (null value is ok). Upon return, if the user pressed OK, then this parameter contains a newly allocated string value. Otherwise, the parameter’s value is unmodified.
pass (Object) – Contains the default value for the password field when this method is called (null value is ok). Upon return, if the user pressed OK, this parameter contains a newly allocated string value. Otherwise, the parameter’s value is unmodified.
- Returns:
Boolean – true for OK, false for Cancel.
- Prompter.promptUsernameAndPasswordBC(browsingContext, modalType, title, text, user, pass)
Puts up a dialog with an edit field and a password field.
- Arguments:
browsingContext (BrowsingContext) – The browsing context the prompt should be opened for.
modalType (Number) – The modal type of the prompt. nsIPromptService.<MODAL_TYPE_WINDOW|MODAL_TYPE_TAB|MODAL_TYPE_CONTENT>
title (String) – Text to appear in the title of the dialog.
text (String) – Text to appear in the body of the dialog.
user (Object) – Contains the default value for the username field when this method is called (null value is ok). Upon return, if the user pressed OK, then this parameter contains a newly allocated string value. Otherwise, the parameter’s value is unmodified.
pass (Object) – Contains the default value for the password field when this method is called (null value is ok). Upon return, if the user pressed OK, this parameter contains a newly allocated string value. Otherwise, the parameter’s value is unmodified.
- Returns:
Boolean – true for OK, false for Cancel.
- Prompter.select(domWin, title, text, list, selected)
Puts up a dialog box which has a list box of strings from which the user may make a single selection.
- Arguments:
domWin (mozIDOMWindowProxy) – The parent window or null.
title (String) – Text to appear in the title of the dialog.
text (String) – Text to appear in the body of the dialog.
list (Array.<String>) – The list of strings to display.
selected (Object) – Contains the index of the selected item in the list when this method returns true.
- Returns:
Boolean – true for OK, false for Cancel.
- Prompter.selectBC(browsingContext, modalType, title, text, list, selected)
Puts up a dialog box which has a list box of strings from which the user may make a single selection.
- Arguments:
browsingContext (BrowsingContext) – The browsing context the prompt should be opened for.
modalType (Number) – The modal type of the prompt. nsIPromptService.<MODAL_TYPE_WINDOW|MODAL_TYPE_TAB|MODAL_TYPE_CONTENT>
title (String) – Text to appear in the title of the dialog.
text (String) – Text to appear in the body of the dialog.
list (Array.<String>) – The list of strings to display.
selected (Object) – Contains the index of the selected item in the list when this method returns true.
- Returns:
Boolean – true for OK, false for Cancel.