зеркало из https://github.com/mozilla/gecko-dev.git
[perf] Reduce the number of webshells used to load a simple alert/confirm dialog
This commit is contained in:
Родитель
3131e1a65f
Коммит
1b5355a16b
|
@ -136,27 +136,18 @@ dump("There are " + numButtons + " buttons\n");
|
|||
|
||||
|
||||
|
||||
// Set the Checkbox
|
||||
// dump(" set checkbox \n");
|
||||
var checkMsg = param.GetString( 1 );
|
||||
// dump("check box msg is "+ checkMsg +"\n");
|
||||
if ( checkMsg != "" )
|
||||
{
|
||||
var prompt = (document.getElementById("checkbox"));
|
||||
if ( prompt )
|
||||
{
|
||||
prompt.setAttribute("value",checkMsg);
|
||||
}
|
||||
var checkValue = param.GetInt( 1 );
|
||||
var element=document.getElementById("checkbox" );
|
||||
var checkbool = checkValue > 0 ? true : false;
|
||||
element.checked = checkbool;
|
||||
}
|
||||
else
|
||||
{
|
||||
var element = document.getElementById("checkbox");
|
||||
element.setAttribute("hidden","true" );
|
||||
}
|
||||
// Set the Checkbox
|
||||
var checkMsg = param.GetString(1);
|
||||
dump("*** checkMsg = " + checkMsg + "\n");
|
||||
if (checkMsg)
|
||||
{
|
||||
var checkboxElement = document.getElementById("checkbox");
|
||||
var checkboxContainer = document.getElementById("checkboxContainer");
|
||||
checkboxContainer.removeAttribute("hidden");
|
||||
checkboxElement.setAttribute("value", checkMsg);
|
||||
var checkValue = param.GetInt( 1 );
|
||||
checkboxElement.checked = checkValue > 0 ? true : false;
|
||||
}
|
||||
|
||||
// handle the edit fields
|
||||
// dump("set editfields \n");
|
||||
|
@ -164,6 +155,8 @@ dump("There are " + numButtons + " buttons\n");
|
|||
switch( numEditfields )
|
||||
{
|
||||
case 2:
|
||||
var editFieldsBox = document.getElementById("editFields");
|
||||
editFieldsBox.removeAttribute("hidden");
|
||||
var element = document.getElementById("dialog.password2");
|
||||
element.value = param.GetString( 7 );
|
||||
|
||||
|
@ -205,6 +198,8 @@ dump("There are " + numButtons + " buttons\n");
|
|||
}
|
||||
break;
|
||||
case 1:
|
||||
var editFieldsBox = document.getElementById("editFields");
|
||||
editFieldsBox.removeAttribute("hidden");
|
||||
var editfield1Password = param.GetInt( 4 );
|
||||
if ( editfield1Password == 1 )
|
||||
{
|
||||
|
@ -249,11 +244,6 @@ dump("There are " + numButtons + " buttons\n");
|
|||
element.focus();
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
// dump("hiding all editfields \n");
|
||||
var element = document.getElementById("editFields");
|
||||
element.setAttribute("hidden", "true");
|
||||
break;
|
||||
}
|
||||
|
||||
// set the pressed button to cancel to handle the case where the close box is pressed
|
||||
|
|
|
@ -4,18 +4,20 @@
|
|||
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
|
||||
<!DOCTYPE window SYSTEM "chrome://global/locale/commonDialog.dtd">
|
||||
|
||||
<window
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
align="vertical"
|
||||
onload="commonDialogOnLoad()"
|
||||
style="width: 40em;"
|
||||
class="dialog">
|
||||
<window id="commonDialog"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
orient="vertical"
|
||||
onload="commonDialogOnLoad()"
|
||||
style="width: 40em;"
|
||||
class="dialog">
|
||||
|
||||
<script language="JavaScript" src="chrome://global/content/commonDialog.js" />
|
||||
<script language="JavaScript" src="chrome://global/content/commonDialog.js"></script>
|
||||
|
||||
<keyset id="keyset"/>
|
||||
|
||||
<box align="horizontal" flex="100%">
|
||||
|
||||
|
||||
<box flex="1">
|
||||
<box autostretch="never">
|
||||
<image id="info.icon" src="chrome://global/skin/message-icon.gif" border="0" style="margin: 5px"/>
|
||||
</box>
|
||||
|
@ -26,30 +28,27 @@
|
|||
</box>
|
||||
</box>
|
||||
|
||||
<box id="editFields" align="vertical" >
|
||||
<box id="editFields" align="vertical" hidden="true">
|
||||
<box align="horizontal" id="loginEditField" >
|
||||
<text id="login.text" value="&editfield0.label;"/>
|
||||
<textfield accesskey="u" tabindex="0" type="text" id="dialog.loginname" flex="100%"/>
|
||||
</box>
|
||||
|
||||
<box align="horizontal" id ="password1EditField">
|
||||
<box id ="password1EditField">
|
||||
<text id="password1.text" value="&editfield1.label;"/>
|
||||
<textfield accesskey="p" tabindex="1" type="password" id="dialog.password1" flex="100%"/>
|
||||
</box>
|
||||
|
||||
<box align="horizontal" id ="password2EditField">
|
||||
<box id ="password2EditField">
|
||||
<text id="password2.text" value="&editfield2.label;"/>
|
||||
<textfield accesskey="p" tabindex="1" type="password" id="dialog.password2" flex="100%"/>
|
||||
</box>
|
||||
</box>
|
||||
|
||||
<box id="checkboxContainer" hidden="true" autostretch="never">
|
||||
<checkbox id="checkbox" oncommand="onCheckboxClick()"/>
|
||||
</box>
|
||||
|
||||
|
||||
<box id="checkboxContainer">
|
||||
<checkbox id="checkbox" oncommand="onCheckboxClick()"/>
|
||||
<!--
|
||||
<text class="label" id="checkboxLabel" for="checkbox"
|
||||
value="&checkbox.label;"/>
|
||||
-->
|
||||
</box>
|
||||
<box id="okCancelButtons"/>
|
||||
</window>
|
||||
|
|
Загрузка…
Ссылка в новой задаче