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.