diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /toolkit/components/prompts/content/commonDialog.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'toolkit/components/prompts/content/commonDialog.js')
-rw-r--r-- | toolkit/components/prompts/content/commonDialog.js | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/toolkit/components/prompts/content/commonDialog.js b/toolkit/components/prompts/content/commonDialog.js new file mode 100644 index 000000000..ef4686654 --- /dev/null +++ b/toolkit/components/prompts/content/commonDialog.js @@ -0,0 +1,62 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +var Ci = Components.interfaces; +var Cr = Components.results; +var Cc = Components.classes; +var Cu = Components.utils; + +Cu.import("resource://gre/modules/Services.jsm"); +Cu.import("resource://gre/modules/CommonDialog.jsm"); + +var propBag, args, Dialog; + +function commonDialogOnLoad() { + propBag = window.arguments[0].QueryInterface(Ci.nsIWritablePropertyBag2) + .QueryInterface(Ci.nsIWritablePropertyBag); + // Convert to a JS object + args = {}; + let propEnum = propBag.enumerator; + while (propEnum.hasMoreElements()) { + let prop = propEnum.getNext().QueryInterface(Ci.nsIProperty); + args[prop.name] = prop.value; + } + + let dialog = document.documentElement; + + let ui = { + prompt : window, + loginContainer : document.getElementById("loginContainer"), + loginTextbox : document.getElementById("loginTextbox"), + loginLabel : document.getElementById("loginLabel"), + password1Container : document.getElementById("password1Container"), + password1Textbox : document.getElementById("password1Textbox"), + password1Label : document.getElementById("password1Label"), + infoBody : document.getElementById("info.body"), + infoTitle : document.getElementById("info.title"), + infoIcon : document.getElementById("info.icon"), + checkbox : document.getElementById("checkbox"), + checkboxContainer : document.getElementById("checkboxContainer"), + button3 : dialog.getButton("extra2"), + button2 : dialog.getButton("extra1"), + button1 : dialog.getButton("cancel"), + button0 : dialog.getButton("accept"), + focusTarget : window, + }; + + // limit the dialog to the screen width + document.getElementById("filler").maxWidth = screen.availWidth; + + Dialog = new CommonDialog(args, ui); + Dialog.onLoad(dialog); + // resize the window to the content + window.sizeToContent(); + window.getAttention(); +} + +function commonDialogOnUnload() { + // Convert args back into property bag + for (let propName in args) + propBag.setProperty(propName, args[propName]); +} |