Set type="password" for the PasswordPrompt input dynamically, to prevent unnecessary warnings in Firefox for http:// documents (issue 6898)

Fixes 6898.

Note that this doesn't prevent the warning for PDF files that *do* ask for a password, e.g. http://async5.org/moz/passwordOU.pdf, but it's not clear to me if/how we could avoid that.
This commit is contained in:
Jonas Jenwald 2016-01-20 13:54:19 +01:00
parent 1eea0db897
commit 4b94416277
2 changed files with 4 additions and 1 deletions

View File

@ -49,6 +49,7 @@ var PasswordPrompt = {
open: function passwordPromptOpen() { open: function passwordPromptOpen() {
OverlayManager.open(this.overlayName).then(function () { OverlayManager.open(this.overlayName).then(function () {
this.passwordField.type = 'password';
this.passwordField.focus(); this.passwordField.focus();
var promptString = mozL10n.get('password_label', null, var promptString = mozL10n.get('password_label', null,
@ -66,6 +67,7 @@ var PasswordPrompt = {
close: function passwordPromptClose() { close: function passwordPromptClose() {
OverlayManager.close(this.overlayName).then(function () { OverlayManager.close(this.overlayName).then(function () {
this.passwordField.value = ''; this.passwordField.value = '';
this.passwordField.type = '';
}.bind(this)); }.bind(this));
}, },

View File

@ -331,7 +331,8 @@ See https://github.com/adobe-type-tools/cmap-resources
<p id="passwordText" data-l10n-id="password_label">Enter the password to open this PDF file:</p> <p id="passwordText" data-l10n-id="password_label">Enter the password to open this PDF file:</p>
</div> </div>
<div class="row"> <div class="row">
<input type="password" id="password" class="toolbarField" /> <!-- The type="password" attribute is set via script, to prevent warnings in Firefox for all http:// documents. -->
<input id="password" class="toolbarField" />
</div> </div>
<div class="buttonRow"> <div class="buttonRow">
<button id="passwordCancel" class="overlayButton"><span data-l10n-id="password_cancel">Cancel</span></button> <button id="passwordCancel" class="overlayButton"><span data-l10n-id="password_cancel">Cancel</span></button>