mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-21 22:57:31 +09:00
Make the Auth prompt DOS protection a browser-element opt-in feature.
This commit is contained in:
parent
7b71e22bee
commit
1e6b075d1d
6 changed files with 40 additions and 14 deletions
|
|
@ -999,7 +999,8 @@
|
||||||
contentcontextmenu="contentAreaContextMenu"
|
contentcontextmenu="contentAreaContextMenu"
|
||||||
autocompletepopup="PopupAutoComplete"
|
autocompletepopup="PopupAutoComplete"
|
||||||
selectmenulist="ContentSelectDropdown"
|
selectmenulist="ContentSelectDropdown"
|
||||||
datetimepicker="DateTimePickerPanel"/>
|
datetimepicker="DateTimePickerPanel"
|
||||||
|
authdosprotected="true" />
|
||||||
</vbox>
|
</vbox>
|
||||||
<vbox id="browser-border-end" hidden="true" layer="true"/>
|
<vbox id="browser-border-end" hidden="true" layer="true"/>
|
||||||
</hbox>
|
</hbox>
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
<xul:vbox flex="1" class="browserContainer">
|
<xul:vbox flex="1" class="browserContainer">
|
||||||
<xul:stack flex="1" class="browserStack" anonid="browserStack">
|
<xul:stack flex="1" class="browserStack" anonid="browserStack">
|
||||||
<xul:browser anonid="initialBrowser" type="content-primary" message="true" messagemanagergroup="browsers"
|
<xul:browser anonid="initialBrowser" type="content-primary" message="true" messagemanagergroup="browsers"
|
||||||
xbl:inherits="tooltip=contenttooltip,contextmenu=contentcontextmenu,autocompletepopup,selectmenulist,datetimepicker"/>
|
xbl:inherits="tooltip=contenttooltip,contextmenu=contentcontextmenu,autocompletepopup,selectmenulist,datetimepicker,authdosprotected"/>
|
||||||
</xul:stack>
|
</xul:stack>
|
||||||
</xul:vbox>
|
</xul:vbox>
|
||||||
</xul:hbox>
|
</xul:hbox>
|
||||||
|
|
@ -1952,6 +1952,10 @@
|
||||||
if (this.hasAttribute("datetimepicker")) {
|
if (this.hasAttribute("datetimepicker")) {
|
||||||
b.setAttribute("datetimepicker", this.getAttribute("datetimepicker"));
|
b.setAttribute("datetimepicker", this.getAttribute("datetimepicker"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.hasAttribute("authdosprotected")) {
|
||||||
|
b.setAttribute("authdosprotected", this.getAttribute("authdosprotected"));
|
||||||
|
}
|
||||||
|
|
||||||
b.setAttribute("autoscrollpopup", this._autoScrollPopup.id);
|
b.setAttribute("autoscrollpopup", this._autoScrollPopup.id);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -965,7 +965,8 @@
|
||||||
tabcontainer="tabbrowser-tabs"
|
tabcontainer="tabbrowser-tabs"
|
||||||
contentcontextmenu="contentAreaContextMenu"
|
contentcontextmenu="contentAreaContextMenu"
|
||||||
autocompletepopup="PopupAutoComplete"
|
autocompletepopup="PopupAutoComplete"
|
||||||
datetimepicker="DateTimePickerPanel"/>
|
datetimepicker="DateTimePickerPanel"
|
||||||
|
authdosprotected="true"/>
|
||||||
<chatbar id="pinnedchats" layer="true" mousethrough="always" hidden="true"/>
|
<chatbar id="pinnedchats" layer="true" mousethrough="always" hidden="true"/>
|
||||||
<statuspanel id="statusbar-display" inactive="true"/>
|
<statuspanel id="statusbar-display" inactive="true"/>
|
||||||
</vbox>
|
</vbox>
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
<xul:vbox flex="1" class="browserContainer">
|
<xul:vbox flex="1" class="browserContainer">
|
||||||
<xul:stack flex="1" class="browserStack" anonid="browserStack">
|
<xul:stack flex="1" class="browserStack" anonid="browserStack">
|
||||||
<xul:browser anonid="initialBrowser" type="content-primary" message="true" disablehistory="true"
|
<xul:browser anonid="initialBrowser" type="content-primary" message="true" disablehistory="true"
|
||||||
xbl:inherits="tooltip=contenttooltip,contextmenu=contentcontextmenu,autocompletepopup,datetimepicker"/>
|
xbl:inherits="tooltip=contenttooltip,contextmenu=contentcontextmenu,autocompletepopup,datetimepicker,authdosprotected"/>
|
||||||
</xul:stack>
|
</xul:stack>
|
||||||
</xul:vbox>
|
</xul:vbox>
|
||||||
</xul:hbox>
|
</xul:hbox>
|
||||||
|
|
@ -1588,6 +1588,10 @@
|
||||||
if (this.hasAttribute("datetimepicker")) {
|
if (this.hasAttribute("datetimepicker")) {
|
||||||
b.setAttribute("datetimepicker", this.getAttribute("datetimepicker"));
|
b.setAttribute("datetimepicker", this.getAttribute("datetimepicker"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.hasAttribute("authdosprotected")) {
|
||||||
|
b.setAttribute("authdosprotected", this.getAttribute("authdosprotected"));
|
||||||
|
}
|
||||||
|
|
||||||
// Create the browserStack container
|
// Create the browserStack container
|
||||||
var stack = document.createElementNS(NS_XUL, "stack");
|
var stack = document.createElementNS(NS_XUL, "stack");
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ LoginManagerPromptFactory.prototype = {
|
||||||
// cancel the prompt until we stop showing it.
|
// cancel the prompt until we stop showing it.
|
||||||
let browser = prompter._browser;
|
let browser = prompter._browser;
|
||||||
let baseDomain = null;
|
let baseDomain = null;
|
||||||
if (browser) {
|
if (browser && browser.isAuthDOSProtected) {
|
||||||
try {
|
try {
|
||||||
baseDomain = Services.eTLD.getBaseDomainFromHost(hostname);
|
baseDomain = Services.eTLD.getBaseDomainFromHost(hostname);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
@ -145,7 +145,7 @@ LoginManagerPromptFactory.prototype = {
|
||||||
prompt.inProgress = false;
|
prompt.inProgress = false;
|
||||||
self._asyncPromptInProgress = false;
|
self._asyncPromptInProgress = false;
|
||||||
|
|
||||||
if (browser) {
|
if (browser && browser.isAuthDOSProtected) {
|
||||||
// Reset the counter state if the user replied to a prompt and actually
|
// Reset the counter state if the user replied to a prompt and actually
|
||||||
// tried to login (vs. simply clicking any button to get out).
|
// tried to login (vs. simply clicking any button to get out).
|
||||||
if (ok && (prompt.authInfo.username || prompt.authInfo.password)) {
|
if (ok && (prompt.authInfo.username || prompt.authInfo.password)) {
|
||||||
|
|
@ -177,15 +177,27 @@ LoginManagerPromptFactory.prototype = {
|
||||||
|
|
||||||
var cancelDialogLimit = Services.prefs.getIntPref("prompts.authentication_dialog_abuse_limit");
|
var cancelDialogLimit = Services.prefs.getIntPref("prompts.authentication_dialog_abuse_limit");
|
||||||
|
|
||||||
let cancelationCounter = browser.authPromptCounter[baseDomain];
|
// Block the auth prompt if:
|
||||||
this.log("cancelationCounter =", cancelationCounter);
|
// - There is an attached browser element
|
||||||
if (cancelDialogLimit && cancelationCounter >= cancelDialogLimit) {
|
// - The browser element has opted-in to DOS protection
|
||||||
this.log("Blocking auth dialog, due to exceeding dialog bloat limit");
|
// - The dialog cancellation limit is not 0 (= feature disabled)
|
||||||
delete this._asyncPrompts[hashKey];
|
// - The amount of cancellations >= the set abuse limit
|
||||||
|
if (browser && browser.isAuthDOSProtected) {
|
||||||
|
let cancelationCounter = browser.authPromptCounter[baseDomain];
|
||||||
|
this.log("cancelationCounter =", cancelationCounter);
|
||||||
|
|
||||||
// just make the runnable cancel all consumers
|
if (cancelDialogLimit && cancelationCounter >= cancelDialogLimit) {
|
||||||
runnable.cancel = true;
|
this.log("Blocking auth dialog, due to exceeding dialog bloat limit");
|
||||||
|
delete this._asyncPrompts[hashKey];
|
||||||
|
|
||||||
|
// just make the runnable cancel all consumers
|
||||||
|
runnable.cancel = true;
|
||||||
|
} else {
|
||||||
|
this._asyncPromptInProgress = true;
|
||||||
|
prompt.inProgress = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// No DOS protection: prompt
|
||||||
this._asyncPromptInProgress = true;
|
this._asyncPromptInProgress = true;
|
||||||
prompt.inProgress = true;
|
prompt.inProgress = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -899,6 +899,10 @@
|
||||||
|
|
||||||
<field name="mIconURL">null</field>
|
<field name="mIconURL">null</field>
|
||||||
|
|
||||||
|
<property name="isAuthDOSProtected"
|
||||||
|
onget="return (this.getAttribute('authdosprotected') == 'true');"
|
||||||
|
readonly="true"/>
|
||||||
|
|
||||||
<!-- This is managed by the tabbrowser -->
|
<!-- This is managed by the tabbrowser -->
|
||||||
<field name="lastURI">null</field>
|
<field name="lastURI">null</field>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue