Interface nsIPromptServiceType

This is the interface to the embeddable prompt service; the service that implements nsIPrompt. Its interface is designed to be just nsIPrompt, each method modified to take a parent window parameter.

Accesskeys can be attached to buttons and checkboxes by inserting an & before the accesskey character in the checkbox message or button title. For a real &, use && instead. (A "button title" generally refers to the text label of a button.)

One note: in all cases, the parent window parameter can be null. However, these windows are all intended to have parents. So when no parent is specified, the implementation should try hard to find a suitable foster parent.

Implementations are free to choose how they present the various button types. For example, while prompts that give the user a choice between OK and Cancel are required to return a boolean value indicating whether or not the user accepted the prompt (pressed OK) or rejected the prompt (pressed Cancel), the implementation of this interface could very well speak the prompt to the user instead of rendering any visual user-interface. The standard button types are merely idioms used to convey the nature of the choice the user is to make.

Because implementations of this interface may loosely interpret the various button types, it is advised that text messages passed to these prompts do not refer to the button types by name. For example, it is inadvisable to tell the user to "Press OK to proceed." Instead, such a prompt might be rewritten to ask the user: "Would you like to proceed?"

Hierarchy

Methods

  • Increases the reference count for this interface. The associated instance will not be deleted unless the reference count is returned to zero.

    Returns

    The resulting reference count.

    Returns number

  • Parameters

    • aIID: object
    • Optional aInstancePtr: object

    Returns any

  • A run time mechanism for interface discovery.

    Returns

    NS_OK if the interface is supported by the associated instance, NS_NOINTERFACE if it is not.

    aInstancePtr must not be null.

    Parameters

    • aIID: object

      [in] A requested interface IID

    • aInstancePtr: object

      [out] A pointer to an interface pointer to receive the result.

    Returns void

  • Decreases the reference count for this interface. Generally, if the reference count returns to zero, the associated instance is deleted.

    Returns

    The resulting reference count.

    Returns number

  • Puts up an alert dialog with an OK button.

    Parameters

    • aParent: mozIDOMWindowProxy

      The parent window or null.

    • aDialogTitle: wstring

      Text to appear in the title of the dialog.

    • aText: wstring

      Text to appear in the body of the dialog.

    Returns void

  • Like alert, but with a BrowsingContext as parent.

    Parameters

    • aBrowsingContext: BrowsingContext

      The browsing context the prompt should be opened for.

    • modalType: number

      Whether the prompt should be window, tab or content modal.

    • aDialogTitle: wstring
    • aText: wstring

    Returns void

  • Puts up an alert dialog with an OK button and a labeled checkbox.

    Parameters

    • aParent: mozIDOMWindowProxy

      The parent window or null.

    • aDialogTitle: wstring

      Text to appear in the title of the dialog.

    • aText: wstring

      Text to appear in the body of the dialog.

    • aCheckMsg: wstring

      Text to appear with the checkbox.

    • aCheckState: boolean

      Contains the initial checked state of the checkbox when this method is called and the final checked state after this method returns.

    Returns void

  • Like alertCheck, but with a BrowsingContext as parent.

    Parameters

    • aBrowsingContext: BrowsingContext

      The browsing context the prompt should be opened for.

    • modalType: number

      Whether the prompt should be window, tab or content modal.

    • aDialogTitle: wstring
    • aText: wstring
    • aCheckMsg: wstring
    • aCheckState: boolean

    Returns void

  • Async version of alertBC

    Returns

    A promise which resolves when the prompt is dismissed.

    Parameters

    • aBrowsingContext: BrowsingContext
    • modalType: number
    • aDialogTitle: wstring
    • aText: wstring

    Returns any

  • Async version of alertCheckBC

    Returns

    A promise which resolves when the prompt is dismissed.

    Resolves

    nsIPropertyBag { checked: boolean }

    Parameters

    • aBrowsingContext: BrowsingContext
    • modalType: number
    • aDialogTitle: wstring
    • aText: wstring
    • aCheckMsg: wstring
    • aCheckState: boolean

    Returns any

  • Async version of confirmBC

    Returns

    A promise which resolves when the prompt is dismissed.

    Resolves

    nsIPropertyBag { ok: boolean }

    Parameters

    • aBrowsingContext: BrowsingContext
    • modalType: number
    • aDialogTitle: wstring
    • aText: wstring

    Returns any

  • Async version of confirmCheckBC

    Returns

    A promise which resolves when the prompt is dismissed.

    Resolves

    nsIPropertyBag { ok: boolean, checked: boolean }

    Parameters

    • aBrowsingContext: BrowsingContext
    • modalType: number
    • aDialogTitle: wstring
    • aText: wstring
    • aCheckMsg: wstring
    • aCheckState: boolean

    Returns any

  • Async version of confirmExBC

    Returns

    A promise which resolves when the prompt is dismissed.

    Resolves

    nsIPropertyBag { checked: boolean, buttonNumClicked: int }

    Parameters

    • aBrowsingContext: BrowsingContext
    • modalType: number
    • aDialogTitle: wstring
    • aText: wstring
    • aButtonFlags: number
    • aButton0Title: wstring
    • aButton1Title: wstring
    • aButton2Title: wstring
    • aCheckMsg: wstring
    • aCheckState: boolean
    • aExtraArgs: any

    Returns any

  • Async version of promptBC

    Returns

    A promise which resolves when the prompt is dismissed.

    Resolves

    nsIPropertyBag { checked: boolean, value: string, ok: boolean }

    Parameters

    • aBrowsingContext: BrowsingContext
    • modalType: number
    • aDialogTitle: wstring
    • aText: wstring
    • aValue: wstring
    • aCheckMsg: wstring
    • aCheckState: boolean

    Returns any

  • Async version of promptAuthBC

    Returns

    A promise which resolves when the prompt is dismissed.

    Resolves

    nsIPropertyBag { ok: boolean }

    Parameters

    • aBrowsingContext: BrowsingContext
    • modalType: number
    • aChannel: nsIChannel
    • level: uint32_t
    • authInfo: nsIAuthInformation

    Returns any

  • Async version of promptPasswordBC

    Returns

    A promise which resolves when the prompt is dismissed.

    Resolves

    nsIPropertyBag { pass: string, ok: boolean }

    Parameters

    • aBrowsingContext: BrowsingContext
    • modalType: number
    • aDialogTitle: wstring
    • aText: wstring
    • aPassword: wstring

    Returns any

  • Async version of promptUsernameAndPasswordBC

    Returns

    A promise which resolves when the prompt is dismissed.

    Resolves

    nsIPropertyBag { user: string, pass: string, ok: boolean }

    Parameters

    • aBrowsingContext: BrowsingContext
    • modalType: number
    • aDialogTitle: wstring
    • aText: wstring
    • aUsername: wstring
    • aPassword: wstring

    Returns any

  • Async version of selectBC

    Returns

    A promise which resolves when the prompt is dismissed.

    Resolves

    nsIPropertyBag { selected: int, ok: boolean }

    Parameters

    • aBrowsingContext: BrowsingContext
    • modalType: number
    • aDialogTitle: wstring
    • aText: wstring
    • aSelectList: invalid

    Returns any

  • Puts up a dialog with OK and Cancel buttons.

    Returns

    true for OK, false for Cancel

    Parameters

    • aParent: mozIDOMWindowProxy

      The parent window or null.

    • aDialogTitle: wstring

      Text to appear in the title of the dialog.

    • aText: wstring

      Text to appear in the body of the dialog.

    Returns boolean

  • Like confirm, but with a BrowsingContext as parent.

    Parameters

    • aBrowsingContext: BrowsingContext

      The browsing context the prompt should be opened for.

    • modalType: number

      Whether the prompt should be window, tab or content modal.

    • aDialogTitle: wstring
    • aText: wstring

    Returns boolean

  • Puts up a dialog with OK and Cancel buttons and a labeled checkbox.

    Returns

    true for OK, false for Cancel

    Parameters

    • aParent: mozIDOMWindowProxy

      The parent window or null.

    • aDialogTitle: wstring

      Text to appear in the title of the dialog.

    • aText: wstring

      Text to appear in the body of the dialog.

    • aCheckMsg: wstring

      Text to appear with the checkbox.

    • aCheckState: boolean

      Contains the initial checked state of the checkbox when this method is called and the final checked state after this method returns.

    Returns boolean

  • Like confirmCheck, but with a BrowsingContext as parent.

    Parameters

    • aBrowsingContext: BrowsingContext

      The browsing context the prompt should be opened for.

    • modalType: number

      Whether the prompt should be window, tab or content modal.

    • aDialogTitle: wstring
    • aText: wstring
    • aCheckMsg: wstring
    • aCheckState: boolean

    Returns boolean

  • Puts up a dialog with up to 3 buttons and an optional, labeled checkbox.

    Returns

    index of the button pressed.

    Buttons are numbered 0 - 2. The implementation can decide whether the sequence goes from right to left or left to right. 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, aButtonFlags is constructed per the following example:

    aButtonFlags = (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.

    Parameters

    • aParent: mozIDOMWindowProxy

      The parent window or null.

    • aDialogTitle: wstring

      Text to appear in the title of the dialog.

    • aText: wstring

      Text to appear in the body of the dialog.

    • aButtonFlags: number

      A combination of Button Flags.

    • aButton0Title: wstring

      Used when button 0 uses TITLE_IS_STRING

    • aButton1Title: wstring

      Used when button 1 uses TITLE_IS_STRING

    • aButton2Title: wstring

      Used when button 2 uses TITLE_IS_STRING

    • aCheckMsg: wstring

      Text to appear with the checkbox. Null if no checkbox.

    • aCheckState: boolean

      Contains the initial checked state of the checkbox when this method is called and the final checked state after this method returns.

    Returns int32_t

  • Like confirmEx, but with a BrowsingContext as parent.

    Parameters

    • aBrowsingContext: BrowsingContext

      The browsing context the prompt should be opened for.

    • modalType: number

      Whether the prompt should be window, tab or content modal.

    • aDialogTitle: wstring
    • aText: wstring
    • aButtonFlags: number
    • aButton0Title: wstring
    • aButton1Title: wstring
    • aButton2Title: wstring
    • aCheckMsg: wstring
    • aCheckState: boolean

    Returns int32_t

  • Puts up a dialog with an edit field and an optional, labeled checkbox.

    Returns

    true for OK, false for Cancel.

    Parameters

    • aParent: mozIDOMWindowProxy

      The parent window or null.

    • aDialogTitle: wstring

      Text to appear in the title of the dialog.

    • aText: wstring

      Text to appear in the body of the dialog.

    • aValue: wstring

      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.

    • aCheckMsg: wstring

      Text to appear with the checkbox. If null, check box will not be shown.

    • aCheckState: boolean

      Contains the initial checked state of the checkbox when this method is called and the final checked state after this method returns.

    Returns boolean

  • Parameters

    • aParent: mozIDOMWindowProxy
    • aChannel: nsIChannel
    • level: uint32_t
    • authInfo: nsIAuthInformation

    Returns boolean

  • Like promptAuth, but with a BrowsingContext as parent.

    Parameters

    • aBrowsingContext: BrowsingContext

      The browsing context the prompt should be opened for.

    • modalType: number

      Whether the prompt should be window, tab or content modal.

    • aChannel: nsIChannel
    • level: uint32_t
    • authInfo: nsIAuthInformation

    Returns boolean

  • Like prompt, but with a BrowsingContext as parent.

    Parameters

    • aBrowsingContext: BrowsingContext

      The browsing context the prompt should be opened for.

    • modalType: number

      Whether the prompt should be window, tab or content modal.

    • aDialogTitle: wstring
    • aText: wstring
    • aValue: wstring
    • aCheckMsg: wstring
    • aCheckState: boolean

    Returns boolean

  • Puts up a dialog with a password field.

    Returns

    true for OK, false for Cancel.

    Parameters

    • aParent: mozIDOMWindowProxy

      The parent window or null.

    • aDialogTitle: wstring

      Text to appear in the title of the dialog.

    • aText: wstring

      Text to appear in the body of the dialog.

    • aPassword: wstring

      Contains the default value for the password 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.

    Returns boolean

  • Like promptPassword, but with a BrowsingContext as parent.

    Parameters

    • aBrowsingContext: BrowsingContext

      The browsing context the prompt should be opened for.

    • modalType: number

      Whether the prompt should be window, tab or content modal.

    • aDialogTitle: wstring
    • aText: wstring
    • aPassword: wstring

    Returns boolean

  • Puts up a dialog with an edit field and a password field.

    Returns

    true for OK, false for Cancel.

    Parameters

    • aParent: mozIDOMWindowProxy

      The parent window or null.

    • aDialogTitle: wstring

      Text to appear in the title of the dialog.

    • aText: wstring

      Text to appear in the body of the dialog.

    • aUsername: wstring

      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.

    • aPassword: wstring

      Contains the default value for the password 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.

    Returns boolean

  • Like promptUsernameAndPassword, but with a BrowsingContext as parent.

    Parameters

    • aBrowsingContext: BrowsingContext

      The browsing context the prompt should be opened for.

    • modalType: number

      Whether the prompt should be window, tab or content modal.

    • aDialogTitle: wstring
    • aText: wstring
    • aUsername: wstring
    • aPassword: wstring

    Returns boolean

  • Puts up a dialog box which has a list box of strings from which the user may make a single selection.

    Returns

    true for OK, false for Cancel.

    Parameters

    • aParent: mozIDOMWindowProxy

      The parent window or null.

    • aDialogTitle: wstring

      Text to appear in the title of the dialog.

    • aText: wstring

      Text to appear in the body of the dialog.

    • aSelectList: invalid

      The list of strings to display.

    • aOutSelection: number

      Contains the index of the selected item in the list when this method returns true.

    Returns boolean

  • Like select, but with a BrowsingContext as parent.

    Parameters

    • aBrowsingContext: BrowsingContext

      The browsing context the prompt should be opened for.

    • modalType: number

      Whether the prompt should be window, tab or content modal.

    • aDialogTitle: wstring
    • aText: wstring
    • aSelectList: invalid
    • aOutSelection: number

    Returns boolean

Generated using TypeDoc